[pmwiki-users] pagelist template brainstorming

Martin Fick mogulguy at yahoo.com
Sun Feb 18 13:53:41 CST 2007


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

> > Additionally, in the template there may be a
> section
> >   
> >   (:notfound:)
> >   Sorry, no pages found for your query.
>
> We could do this within the proposed syntax with:
> 
>     (:first:)
>     (:if equal {>$Group}:)
>     Sorry, no pages found for your query.
> 
> or even
> 
>     (:last:)
>     (:if equal {$$PageCount} 0:)
>     Sorry, no pages found for your query.


All of these solutions require some more complex
pagelist processing since in the case when there
aren't any pages the main pageliste template
processing loop never even gets executed!  But I think
that the (:notfound:) option would actually be easiest
to implement (to scan for outside of the main loop)
and be way more readible than the other solutions.

> I can see value in having a (:notfound:) shortcut
> for this... but somehow I prefer to avoid adding
> too many special-purpose directives here (in spite
> of the fact that I've just proposed four
> new ones :-).


Well, they greatly all add to readability I think
without detracting from it.  The general use of the
less readable (:if:)s can be left to advanced
conditions.

I am excited by the idea of simplifying many of the
default templates without sacrificing power with this,
since templates have always been a little hard to
"get"!


In the name of performance, I can think of another
case of ifs that could be optimized.  Imagine a
template that uses a conditional that does not change
inside the template like this:

  (:if group Photos:)

or maybe using a pagelist option:

  (:if equal {$$order} group :)

or with an extension like the HttpVariables extension,
like this:

  (:if equal {$?var} foo :)

These conditionals can be processed before the
template actually iterates over each page since the
condition will not change inside the iteration.  Could
we also detect these kinds of conditionals and also
optimize them out somehow?

-Martin



 
____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.



More information about the pmwiki-users mailing list