[pmwiki-users] pagelist pagination

Patrick R. Michaud pmichaud at pobox.com
Wed May 16 23:51:59 CDT 2007


On Wed, May 16, 2007 at 09:05:06PM -0700, Martin Fick wrote:
> Another point that I forgot to mention in the previous
> email is that the =if solution still gets nasty with
> nested ifs since it implies one condition just to
> check if the page should be included or not, all other
> conditions would have to be nested in this (including
> headers!).
> 
> 
> Consider your template:
> 
> > >     [[#mytemplate]]
> > >     (:if ! equal {<$Group} {=$Group}:)
> > > 
> > >     {=$Group}:
> > >     (:if auth edit {=$FullName):)
> > >     * {=$FullName}
> > >     [[#mytemplateend]]
> 
> To use ifs to limit this, one would have to either:
> (please excuse all the syntax bastardizations) :(
> 
> 1)
>      [[#mytemplate]]
>      (:if expr ! equal {<$Group} {=$Group} &&
>       {$$PageCount}} -ge {$$start} &&
>       {$$PageCount}} -lt {$$end} :)
>  
>      {=$Group}:
>      (:if expr auth edit {=$FullName) &&
>        {$$PageCount}} -ge {$$start} &&
>        {$$PageCount}} -lt {$$end} :)
>      * {=$FullName}
>      [[#mytemplateend]]

With the if= solution I would expect to use:

  [[#mytemplate]]
  (:if ! equal {<$Group} {=$Group} :)

  {=$Group}:
  (:if:)
  * {=$FullName}
  [[#mytemplateend]]

and then the pagelist directive would be:

  (:pagelist if="auth edit {=$FullName}" count={?start}..{?end} ... :)

The counts would be correct because we would always be counting
only those records that make it past the if= condition.  There
wouldn't be any group headers for groups that don't have any pages
matching the if= condition.

> Wow, this really is complicated to get right!  Makes
> me like the simple (:iteration:) solutin since it gets
> things mostly right,

So does the if= approach, as given above.

Pm



More information about the pmwiki-users mailing list