[Pmwiki-users] Feature request?

J. Perkins jason
Fri Nov 21 07:03:20 CST 2003


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


John Rankin wrote:
> Jason, a couple of thoughts:
> 
> - what happens if $t isn't a wikiword?
> 
> - for consistency with (say) the search results page, you probably
>   do want to handle "HomePage"
> 
> So how about the following:
> 
> 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);
> }
> 
> JR






More information about the pmwiki-users mailing list