[pmwiki-users] pagelist template brainstorming

Martin Fick mogulguy at yahoo.com
Mon Feb 26 22:18:46 CST 2007


--- "Patrick R. Michaud" <pmichaud at pobox.com> wrote:
> There's also a bit more to it than this... I'm
> running into possibilities for using pagelist-like
> templates on things other than pagelists, such as
> attachlist (but there are others).  So,
> part of me thinks we may be better of sticking with
> the simple (:first:)/(:each:)/(:last:) approach
> instead of trying to explain (:pagelist-first:) vs.
> (:attachlist-first:) vs. (:whatever-first:), etc. 
> In other words, the directives may make sense in
> contexts other than pagelists, even if we don't
> know what those contexts are yet.

Yes, I have been thinking the same thing for a while
and even have some other applications myself.  I think
that the more we can make templating like a generic
form of list processing the better.  Even if the code
is not always shared, but the terminolgy is it would
be an advantage.

But, along the lines of sharing code... it would be
nice if certain directives/markups could simply return
lists that other directives/markups could then process
or that could simply be displayed.  To give an
example, I would like to be able to enhance both the
HttpVariables recipe and Wikipaths to output lists
that could than be processed by the same directives.  

Imagine the example of a DB query that returns a table
with columns X Y and Z.

(:select X, Y, Z from TableA :)

If simply left as is would end up displaying as a
table, but if enclosed in list templating directive
could be templated just like a pagelist could.

(:list fmt=#template:)
(:select X, Y, Z from TableA :)
(:endlist:)

In the template, certain variables would then be
available for each row and one could make a table like
this:

[[#template]]
(:first:)
||'''X'''||'''Y'''||'''Z'''||
(:each:)
|| %blue%{=$X}%% || %red%{=$Y}%% || %green%{=$Z}%% ||
[[#templateend]]

So how could this be made to happen?  I was thinking
that if lists returned XML (over desinged?) or some
other special markup delineating cells and rows.  This
markup can then be easily parsed by the list markup
and applied to templates, something like this:

<record num=1 class=db><el name='X' class=db> valX1
</el><el name='Y' class=db> valY1 </el><el name='Z'
class=db> valZ1 </el></record>
<record num=2 class=db><el name='X' class=db> valX2
</el><el name='Y' class=db> valY2 </el><el name='Z'
class=db> valZ1 </el></record>
...

Along with this there wold be some default rule that
would turn this markup into something presentable in
case the list was not templated.  This default rule
could even be class dependent so that individual
recipes could specify their default markup.  A simple
default might be to turn it into a table or in the
case of pagelist, an unordered list.




 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front



More information about the pmwiki-users mailing list