[pmwiki-users] Split a
Patrick R. Michaud
pmichaud at pobox.com
Thu Nov 9 08:35:21 CST 2006
On Thu, Nov 09, 2006 at 09:24:44AM +0000, Hans wrote:
> ...
> and have {$ParentPage} defined in local/config.php like this,
> cutting off the "-Comments" part from the page name:
>
> # add page variable {$ParentPage}
> $FmtPV['$ParentPage'] = 'CutString($pn,"-Comments")';
> function CutString ($pagename,$cut) {
> $p = str_replace($cut,"",$pagename);
> return $p;
> }
Note that this can now also be done by using the built-in
{$BaseName} page variable -- simply set
$BaseNamePatterns['/-Comments$/'] = '';
and then one can use {$BaseName} to convert
'Group.SomePage-Comments' into 'Group.SomePage'.
To get just the name, as in 'SomePage', use {{$BaseName}$Name}.
Pm
More information about the pmwiki-users
mailing list