[pmwiki-users] Am I stupid? PageVar function

Patrick R. Michaud pmichaud at pobox.com
Tue Jan 3 08:25:38 CST 2006


On Tue, Jan 03, 2006 at 01:53:35PM +0000, Karl Loncarek wrote:
> Hi,
> I'm using the way commenting as described in Cookbook/CommentPageLink
> 
> Now I have problems with the backlinks:
> In the cookbook entry the following was suggested:
>     Markup('{$BaseName}', '>{$fmt}',
>       '/{\\$BaseName}/',
>       preg_replace('/-/', '.', FmtPageName('$Name', $pagename), 1));
> 
> This does not work in 2.1beta17
> As I saw in 2.1beta15 the FmtPageName function was changed and PageVar 
> introduced, so I changed the above to
>     Markup('{$BaseName}', '>{$fmt}',
>       '/{\\$BaseName}/',
>       preg_replace('/-/', '.', PageVar($pagename,'$Name'), 1));

There's no longer a '{$fmt}' markup (it's all handled by PageVar in
the {$var} markup), so the above needs to read:

    Markup('{$BaseName}', '<{$var}',
      '/{\\$BaseName}/',
      preg_replace('/-/', '.', PageVar($pagename,'$Name'), 1));

Or, $BaseName can be added as a page variable with

    $FmtPV['$BaseName'] = 'str_replace("-", ".", $name)';

in which case no Markup() call is needed, and {$BaseName} will
work anywhere the other page variables work.

Pm




More information about the pmwiki-users mailing list