[pmwiki-users] pagelist pagination

Martin Fick mogulguy at yahoo.com
Thu May 17 00:39:27 CDT 2007


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

> 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.

Ah, I understand now, I must have missed this earlier.
 Hmm, what's nice about that also is that since the
limiting condition is not in the template, the
template is more generic, that is just the normal
group template!  The if= is truly a filter.  But, it
assumes that we can keep the template out of the
business of filtering altogether.  

But how do we deal with filtering that does occur in a
template?  Some filtering cannot be avoided can it? 
Do we want authors to have to keep their ifs in sync
with the filter?  It may not be the same author even.

   [[#mytemplate]]
   (:if ! equal {<$Group} {=$Group} :)
 
   {=$Group}:
   (:if auth edit {=$FullName} :)
   * %%red% {=$FullName}
   (:if auth read {=$FullName} :)
   * %%green% {=$FullName}
   [[#mytemplateend]]

I now need to fitler or I get headers for the
unreadable pages, or worse, if there is no header
section:

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

It's less obvious, but am I not back to the count
being off unless I end up filtering in the pagelist. 
So either all users of the template would have to
specify:

  (:pagelist if="auth edit {=$FullName} || auth read
{=$FullName}" :)

This could maybe become:

  (:template defaults if="auth edit {=$FullName} ||
auth read {=$FullName}" :)

but it must be kept it in sync now.  Would there be a
reason to not use both solutions (if= and
(:iteration:) )?  Would there be any cases where this
combination becomes less accurate than either one by
itself?  Seems like it would even prevent the most
mistakes wouldn't it?

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

would do the right thing even without an if= in the
pagelist and a smart author might additonally specify
this for efficiency's sake up front:

  (:template defaults if="auth edit {=$FullName} ||
auth read {=$FullName}" :)


-Martin



 
____________________________________________________________________________________
Sucker-punch spam with award-winning protection. 
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html



More information about the pmwiki-users mailing list