[Pmwiki-users] Feature request?
Christian Ridderström
chr
Sat Nov 22 12:36:52 CST 2003
Hi
Thank's for this tip!
I think it should become a standard part of pmwiki, possibly disabled per
default. Below I've pasted the function including Jason's latest
suggestion, and a comment. Hope the comment is accurate...
//
// Automatic group links
//
// The hook below changes a wiki-link pointing to a non-existing page,
// so that it points to the homepage of a group with the same name as the
// link (if that group and it's homepage exists).
//
$FmtWikiLink = 'MyFmtWikiLink';
function MyFmtWikiLink($pat,$ref,$btext,$out=NULL,$pname=NULL) {
global $DefaultTitle;
$pg = FmtWikiLink($pat,$ref,$btext,'PageName',$pname);
if (!PageExists($pg))
{
$t = preg_replace("/^.*\\./",'',$pg);
if (PageExists("$t.$t"))
$ref = "$t/\{\{$t}}"; // in case $t isn't a wikiword
elseif (PageExists("$t.$DefaultTitle")) // try HomePage
$ref = "$t.$DefaultTitle";
}
return FmtWikiLink($pat,$ref,$btext,$out,$pname);
}
/Christian
On Thu, 20 Nov 2003, J. Perkins wrote:
> John,
>
> Getting closer! On my system, the string "{{$t}}" printed the value of
> $t between curly quotes, ie. "{WikiWord}", so I changed that line to
>
> $ref = "$t/\{\{$t}}"; // in case $t isn't a wikiword
>
> ...which seemed to do the trick.
>
> Jason
--
Dr. Christian Ridderstr?m, +46-8-768 39 44 http://www.md.kth.se/~chr
More information about the pmwiki-users
mailing list