[pmwiki-users] pagelist pagination

Patrick R. Michaud pmichaud at pobox.com
Wed May 16 11:05:44 CDT 2007


On Wed, May 16, 2007 at 05:55:20PM +0200, noskule wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Patrick R. Michaud schrieb:
> > I'm not sure what my plans for this will be.  It is a tricky problem,
> > because if a pagelist template uses any (:if:) directives to exclude
> > pages from appearing in a list, then we can't be certain of the
> > count of pages being displayed.  
> > 
> > For example, people will get very confused if they specify count=1..10,
> > but an (:if:) directive in the pagelist template only displays 5 of them.
> 
> a new argument called break, part, split or the like could be used
> 
> (:pagelist count=50 break=10:)
> 
> would mean take 50 units and display it in junks of then units.

This doesn't really solve the problem, in that it's not 
currently possible for (:pagelist:) to know exactly how many 
"units" are actually displayed by the pagelist template.

For example, consider the following pagelist, which displays
only those pages for which the visitor has edit permission:

    (:pagelist fmt=#mytemplate count=10:)

    [[#mytemplate]]
    (:if auth edit {=$FullName}:)
    * {=$FullName}
    [[#mytemplateend]]

Suppose the site contains exactly ten pages that the visitor
can edit.  Will the visitor see all ten in this pagelist?

The answer is "no", because pagelist first generates a list
of pages, uses count= to cut the list to the first ten, and
then displays those ten pages using the pagelist template.
But the template will not display any of the pages that
the visitor cannot edit, thus the number of pages that
gets displayed could be much fewer than ten -- even zero!

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.

If we ignore the possibility of some pages not being
displayed by (:if:), the problem does become much simpler.

Pm



More information about the pmwiki-users mailing list