[pmwiki-users] BaseName variable [From: Archiving old/obsolete pages]

Patrick R. Michaud pmichaud at pobox.com
Fri Sep 22 13:56:34 CDT 2006

On Fri, Sep 22, 2006 at 02:42:30PM -0400, The Editor wrote:
> Some time ago Pm, you mentioned a possible core change that would
> allow for a {$BaseName} for use in Pagelists.  I thought I would
> resurrect that idea at this point.
> [...]
> For ex:  if I wanted to limit search of all my data files in groups
> Data-*.*, I would want to define $BaseName in such a way to be able to
> put {$BaseName} in a pagelist template and get back links to  *.* for
> all the pages it returns.  Ideally, it would only strip the prefix if
> it existed.

Hmm, that's not what I have in mind for {$BaseName} -- as I'm
envisioning it, {$BaseName} will return the name of a page without
any suffixes.  I wasn't thinking of doing anything with prefixes ...
but perhaps I can add this capability as well.

Essentially, an administrator and/or recipes will define 
suffix (and prefix?) patterns that {$BaseName} is to remove or
change.  So, for example, to define "-Talk" as a suffix to
be removed in {$BaseName}, we would define:

    $BaseNamePatterns['/-Talk$/'] = '';

So, I guess it's not too difficult to get basename to strip off
prefixes as well:

    $BaseNamePatterns['/^Data-/'] = '';

Regardless of how we define it, {$BaseName} will work in
pagelists by using {=$BaseName}, {<$BaseName}, etc. in the
pagelist template, the same way we do it for other page variables.


More information about the pmwiki-users mailing list