[pmwiki-users] if directive and pagelist and LocalTemplate

Patrick R. Michaud pmichaud at pobox.com
Thu May 3 08:16:08 CDT 2007


On Thu, May 03, 2007 at 02:49:25PM +0200, SMETS Stephane     BKS-IT wrote:
> > So my conclusion is : in the case of a pagelist, the "name" test 
> > uses the current page name and not a pagename coming from the 
> > pagelist, by opposite of the wiki variables like $FullName
> 
> That is the correct behaviour.
> 
> (:if name ...:) always tests the name of the current page, whether the
> condition is inside a pagelist template or not.
>
> Hum, it seems not logical to me, but if it is the normal behaviour.. 

It's the "correct behavior" only in the sense that there's not an easy
way to make it work otherwise -- there's not an easy way to tie
"(:if name:)" to match against individual pages in the list.
I agree it's not entirely logical, but I don't have a good fix
using (:if name:).

> I can't remember whether there is an if condition that does matching (as
> distinct from equality).  

There is, but it's deprecated and will probably be removed in
an upcoming beta.  I'm expecting to add

    (:if match <pattern> <string>:)

where <string> will default to the name of the currently displayed
page if not specified.  The <pattern> will take wildcards, thus
for a pagelist template one will be able to do:

    (:if match *EMSQUERY* {=$Name} :)

I'll see if I can get this into a beta release (like, today or 
tomorrow).

Pm




More information about the pmwiki-users mailing list