[pmwiki-users] pagelist pagination

The Editor editor at fast.st
Wed May 16 15:56:03 CDT 2007


On 5/16/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> On Wed, May 16, 2007 at 03:59:13PM -0400, The Editor wrote:
> > On 5/16/07, Patrick R. Michaud <pmichaud at pobox.com> wrote:
> > >On Wed, May 16, 2007 at 03:17:37PM -0400, The Editor wrote:
> > >> 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.
> > >
> > >Well, it can't be a standard "markup expression" as in {(...)}, because
> > >those are evaluated before any (:if:) directives.  The same goes
> > >for standard page variables.  It has to be a specialized form of
> > >markup.
> >
> > Actually that's exactly what I was thinking. The first time the
> > template passes over {(counter)} for example, it returns 1. The next
> > time it returns 2. etc. Then in a conditional you just do if
> > {(counter)} < 50...
>
> I don't think you've followed what I've been saying.
>
> Do you mean that you want {(counter)} to be its own specialized
> markup, as in having its own Markup() rule?  Or do you mean that it's a
> standard markup expression, using the existing {(...)} markup?

Standard markup expression.

> Either way I think you'll find that it's not going to work.
> But we can test it -- just post an example pagelist template to the
> list that demonstrates how you think {(counter)} should work, and
> I'll check the logic.  Start with the pagelist template I gave
> earlier -- namely:
>
>    [[#mytemplate]]
>    (:if auth edit {=$FullName}:)
>    * {=$FullName}
>    [[#mytemplateend]]
>
> Add whatever (:if:) directives or other markups you want to the
> above such that it displays the first ten pages for which a person
> has edit permission.

Ok, I will do--but two quick questions:

1.  Do you have a do the < > conditional?

2.  Is there some way to break out of a pagelist when you've reached
your limit? It's kind of inefficient to run through every page and
just reject everyone past 10. It's doable, but not ideal.

> (Using if="auth edit {=$FullName}" in the pagelist directive itself
> is cheating here -- we want to get an accurate count based on the
> pages displayed after (:if:) markups have been processed.)

No problem. Wasn't what I was thinking at all...

Cheers,
Dan



More information about the pmwiki-users mailing list