[ZPT] ZPT beginner questions

richard@bizarsoftware.com.au richard@bizarsoftware.com.au
Wed, 11 Apr 2001 09:05:39 +1000


Sim Harbert wrote:
> 
> Are there some good examples of Page Template files that
> I can look over while trying to figure out how to use them?
> The "examples" area of the Wiki is pretty sparse.
> 
> What I am trying to do is to execute Python code, and find
> that ZPT's don't function much like DTML.  I have DTML like
> 
>     <dtml-in "getList('foo')" size="10">
>         <dtml-var sequence-item><br>
>     </dtml-in>
> 
> and would like to translate that to ZPT.  The function
> "getList()" is defined for one of the parent objects for the
> current folder in a Python base class.

A "direct" translation isn't possible at the moment, because batching
hasn't been implemented for tal:repeat. The rest of the functionlity could
be implemented as:

<div tal:repeat="item python:here.getList('foo')">
 <span tal:replace="item">item</span><br>
</div>

My wiki editing skills suck - I tried to add an example to
http://dev.zope.org/Wikis/DevSite/Projects/ZPT/LoopExamples but I stuffed
up the formatting. I can't edit the page to fix it either, so it stays
stuffed ;)


    Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)