[pmwiki-users] group conditional...

Patrick R. Michaud pmichaud at pobox.com
Fri Mar 23 09:23:41 CDT 2007


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.

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'.

Pm



More information about the pmwiki-users mailing list