[pmwiki-users] pagelist pagination

The Editor editor at fast.st
Wed May 16 14:17:37 CDT 2007


On 5/16/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Wed, May 16, 2007 at 09:18:12AM -0700, Martin Fick wrote:
> > > So, because it's possible to use (:if:) directives
> > > to suppress the display of certain pages in the
> > > list, we don't know exactly how many pages are displayed,
> > > nor are we certain of the exact "count" to use for
> > > the next block of pages.
> >
> > While it would be less efficient a simple solution
> > might be to limit the count during the template
> > processing instead by simply not counting any
> > iterations that don't produce any output,
>
> PmWiki doesn't run the markup engine on each iteration --
> it concatenates all of the iterations together into
> a single markup string, and then runs the markup engine on
> the concatenated result.  Thus, we can't know which
> iterations generate output.
>
> The problem becomes even worse if we do "inline pagelists",
> where the markup is inserted directly into the surrounding
> page as opposed to being converted into HTML inside of the
> (:pagelist:) command itself [1].  In that case we *definitely*
> don't know the result of any conditionals within iterations
> before the overall page has been processed.
>
> [1]  http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user/40660/focus=40704
>
> Pm


But you could put a markup expression in the template that serves as a
counter. It saves the value to a global and then retrieves it each
time it iterates through the template then resaves the new value and
returns it both.  This would allow it to be displayed in the pagelist
template in a conditional for example.

To be a bit fancier you could also do the same thing for page number
(as page 1 = 1-50, page 2 = 51-100). I'm kind of occupied right at the
moment, but it seems an easy way to do what you are talking about.

Cheers,
Dan



More information about the pmwiki-users mailing list