[pmwiki-users] pagelist pagination

Martin Fick mogulguy at yahoo.com
Wed May 16 22:23:54 CDT 2007


--- "Patrick R. Michaud" <pmichaud at pobox.com> wrote:

> On Wed, May 16, 2007 at 05:10:41PM -0700, Martin
> Fick wrote:
> > What if the templating engine put a special markup
> > around each iteration like this:
> > 
> > (:iteration:)
> > ...
> > (:iteration:)
> > ...
> > (:iterationend:)
> > 
> > This markup would basically mean: "if the section
> > after this is not blank, increment internal
> > counter and if the counter is not within the
> > paging range, delete everything up until the next
> > (:iteration:).
> 
> > This would not require any thought on the user's
> > part in the template, the pagelist count would
> > just magically work! :)
> 
> Alas, I think this still has some holes in it. 
> Consider a order-by-group template like:
> 
>     [[#mytemplate]]
>     (:if ! equal {<$Group} {=$Group}:)
> 
>     {=$Group}:
>     (:if auth edit {=$FullName):)
>     * {=$FullName}
>     [[#mytemplateend]]
> 
> If the visitor doesn't have edit permission to the
> first page in any group, we still end up counting
> the page (because the per-group header makes the
> interval "non-blank").
> 
> The same is true even if we use (:template first
> {=$Group}:) instead of (:if ! equal {<$Group} 
> {=$Group} :) .

Yes, this is indeed a valid problem, but one that I
think I think points out to me the strengths of this
solution over all the others.  This example is truly
an interesting corner case that proves that no
automated solution will work 100%!  

That being said, I think that this problem is not a
strong enough reason to eliminate this solution. 
Afterall, what are the alternatives?  The way I see
it, the two possible extremes to this problem are:

 1) We automate the count and never get it perfectly
    right 
 2) We force the user to indicate how & when 
    to count an iteration causing him to have to
    always think about it

The above solution along with a previously suggested
[*1] solution provides a very good compromise between
the 2 extremes.  With this solution the count will be
more accurate than currently, even if not perfect.  In
fact I think that it will be accurate in most
instances without users ever having to think about it,
and [*2] I think that even when it stands to be in
accurate, it has a chance of actually producing
inaccurate but appropriate behavior.


[*1]  Since the (:iteration:) markup would have to be
evaluated after conditionals to be effective, we can
also allow a user to use another token markup to
further define sections as not contributing to the
count if the token survives conditionals. i.e.
(:template nocount:).

[*2] Although in your case the header does not
constitute a page per-say, it still may be good to
count it as an iteration, consider what would happen
if there were a thousand of these headers without any
editable pages in between, the user would still
benefit from paging!  Paging is afterall probably the
real the goal, not the accurate count.

-Martin



 
____________________________________________________________________________________
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.
http://mobile.yahoo.com/mail 



More information about the pmwiki-users mailing list