[TransWarp] Template parsing and XML/HTML processing design

Roché Compaan roche at upfrontsystems.co.za
Mon Jul 21 11:56:28 EDT 2003


* Phillip J. Eby <pje at telecommunity.com> [2003-07-21 15:46]:
> >I like this kind of ZPT very much::
> >
> > <table>
> > <tr tal:repeat="item here/tabulardata">
> >   <td tal:condition="repeat/item/even"
> >       tal:content="item" class="evenrow">
> >     Even row</td>
> >   <td tal:condition="repeat/item/odd"        tal:content="item" 
> >class="oddrow">
> >     Odd row</td>
> > </tr>
> > <tr tal:replace="nothing>
> >   <td class="evenrow">Sample data, as much as needed</td>
> > </tr>
> > <tr tal:replace="nothing>
> >   <td class="oddrow"> for a realistic mockup.</td>
> > </tr>
> > </table>
> 
> <table xmlns:pt="http://peak.telecommunity.com/peak.web.templates/" 
> pt:model="tabulardata" pt:view="list">
> <tr pt:pattern="listItem">
>    <td class="oddrow" pt:view="text">Odd row</td>
> </tr>
> <tr pt:pattern="listItem">
>    <td class="evenrow" pt:view="text">Even row</td>
> </tr>
> <tr>
>    <td class="oddrow">Sample data, as much as needed</td>
> </tr>
> <tr>
>    <td class="evenrow">for a realistic mockup.</td>
> </tr>
> </table>
> 
> Using "listItem" more than once causes the "list" view to rotate through 
> the patterns.  Of course, I have to put the odd row first.  The "list" and 
> "text" views also drop any content within them that isn't part of a 
> pattern, so you don't have to add any special markup to sample data 
> contained within them.

This looks very promising. We were just testing if you still have all
the answers ;-)

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the PEAK mailing list