[pmwiki-users] group conditional...

The Editor editor at fast.st
Fri Mar 23 10:09:57 CDT 2007


On 3/23/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Fri, Mar 23, 2007 at 10:16:35AM -0400, The Editor wrote:
> > Yes but in this situation, it fails.  Or rather it returns true for
> > group Comments-Test.  Evidently this does not work in a template?
> >
> > (:markup:)[=
> > (:pagelist group=Comments-* fmt=#test:)
> > =]
> >
> > >>comment<<
> > [[#test]]
> > (:if group Comments-Snippets*:)
> > *Yes: [[{=$FullName}]]
> > (:else:)
> > *No:  [[{=$FullName}]]
> > (:if:)
> > [[#testend]]
> > >><<
>
> Well, yes.
>
> The (:if group:) directive _always_ checks the name
> of the currently displayed page, it doesn't use the value of
> {=$FullName} or {=$Group} from within pagelist templates.
> (It doesn't have any way of knowing the name inside of a pagelist
> template.)
>
> This is also why we have generally used
>
>    (:if equal {=$Name} "HomePage":)
>
> instead of
>
>    (:if name HomePage:)
>
> inside of pagelist templates.

Of course this won't work in my case as I need a wildcard match...

> I've been thinking of adding a wildcard match conditional, so that
> one could use:
>
>    (:if match Comments-Snippets* {=$Group}:)
>
> The existing 'match' conditional (which accepts a regex) would
> be renamed to 'regex'.

That would be nice.  For the record, my workaround (since I'm using
Hg) was to do this:

(:if equal '{=$g1}-{=$g2}' 'Comments-Snippets':)

Works great.  (Love the Hg/Cluster recipes!--Works great for so many
things...)  Anyway, thanks for the assist!

Cheers,
Dan



More information about the pmwiki-users mailing list