[pmwiki-users] Pagelist conditionals

Martin Fick mogulguy at yahoo.com
Mon Feb 19 23:36:03 CST 2007


--- "Patrick R. Michaud" <pmichaud at pobox.com> wrote:
> I'm still not certain of how to do paged output
> when the pagelist template itself does some form of
> selecting records to display.  

Yes, you've mentioned this before, very tricky and
still a problem for the fmt=#group template isn't it?

> Perhaps an  (:if count:) directive or a {$Counter}
> page variable that keeps track of the number of
> times it has been evaluated in the context of a
> particular set of markup. 

I don't understand this, maybe I'm too dense, could
you give an example?


> Or perhaps a directive that increments a named
> counter of some sort.

Now that sounds like a neat idea!  So the group
template could look like this:

[[#group]]
(:if ! equal {=$Group} {<$Group}:)
(:increment-count:)
* [[{=$Group}/]]
[[#groupend]]

But, then how does it know that in other cases when
someone does not specify an (:increment-count:)
directive in a template that the count should always
be incremented?  Maybe not as intuitive, but an
alternative would be to use a directive instead to
indicate the need to NOT increment the count, maybe
like this?:

[[#group]]
(:if ! equal {=$Group} {<$Group}:)
* [[{=$Group}/]]
(:if equal {=$Group} {<$Group}:)
(:skip-count:)
[[#groupend]]

...but, I think that's ugly! :)  I guess you could
pre-scan the template and if there is no
(:increment-count:) directive anywhere, automatically
increase the count on each iteration?


What about all the new suggestions of having special
grouping options within templates, could the
(:increment-count:) type directive be used to control
the count within the individual groupings?

  (:increment-count name:) 
  (:increment-count department:) 
  ...


-Martin



 
____________________________________________________________________________________
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/



More information about the pmwiki-users mailing list