[pmwiki-users] $BaseName (was Re: pmwiki-2.2.0-beta9 release (bugfix, pagevar filters in pagelists))

The Editor editor at fast.st
Tue Oct 3 07:45:53 CDT 2006


On 10/3/06, Kathryn Andersen <kat_lists at katspace.homelinux.org> wrote:
> On Mon, Oct 02, 2006 at 12:43:04PM -0500, Patrick R. Michaud wrote:
> > On Mon, Oct 02, 2006 at 11:32:27AM -0400, Crisses wrote:
> > This is now possible in 2.2.0-beta10 (just released), using
> > the new {$BaseName} page variable markup.
>
> I'm a bit confused about what the $BaseName actually gives you, what it
> actually applies to.

One reason for this variable is for uses like FAST Data, which stores
data on a separate Data-Group.Name page.  But displays it dynamically,
formatted nicely on Group.Name.  So to find a page with certain data,
you want to search the Data pages, but return the display page.  This
makes it possible to do that.

> > Essentially, an administrator or recipe uses $BaseNamePatterns
> > to define transformations from a pagename into its "base" form.
> > For example, a comments recipe might define:
> >
> >     $BaseNamePatterns['/-Talk$/'] = '';
>
> Are the BaseNamePatterns applied to the $FullName of the page?
> Or the $Name of the page?

Full Name

> > and then in the pagelist template to refer to the non-Data
> > group regardless of source one would use things like:
> >
> >     {=$BaseName}           "Simile.XYZ"
> >     {{=$BaseName}$Group}   "Simile"
> >
> I don't understand the nested { } markup -- what does that do?
>
> > Or, to always get the Data- group regardless of source, one would use:
> >
> >     Data-{=$BaseName}           "Data-Simile.XYZ"
> >     Data-{{=$BaseName}$Group}   "Data-Simile"

I haven't seen the nested thing documented, but thees lines simply
explains how the BaseName variable can be used in a pagelist template.
 If the nesting thing works, it would answer you question below.

> What if I had a page, say, "Stories-Highlander.DeadlySecrets"
> Does this mean that if I had
>
>      $BaseNamePatterns['/^Stories-/'] = '';
>
> Then the $BaseName of that page would be "Highlander.DeadlySecrets"?
> What if I wanted just the "base group"?  (In this case, "Highlander")
> Would I be able to get that?

See above.

Alternately, though I'm not too good with pattern matching, it seems
you could strip off the prefix, and/or anything after the "." which
wold give you just Highlander.  Of course in the pagelist, you might
end up with a lot of links to default group pages, ie: [[Highlander]].

Cheers,
Caveman




More information about the pmwiki-users mailing list