[Zope] Converting DTML IN loop to Repeat loop ZPT

Nico de Boer nico@nfg.nl
30 May 2002 13:52:53 +0200


Hi all,

I'm trying to convert a dtml-in loop to a repeat loop in a Zope Page
Template.

I want to create a chain menu with options: Previous | Current | Next.

This is my DTML Code (list_chain is a python method that returns three
objects (Previous, Current, Next) or None for the object that doesn't
exists. Example: The method returns (None, Current, Next) for the
first object.

<dtml-in list_chain>
<dtml-if sequence-start>
  <dtml-if sequence-item>
   <a href="<dtml-var absolute_url>">Previous</a></dtml-if>
<dtml-elif sequence-end>
  <dtml-if sequence-item>
   <a href="<dtml-var absolute_url>">Next</a></dtml-if>
<dtml-else>
  <b><dtml-var title_or_id></b>
</dtml-if>
</dtml-in>

I tried something and it looks like this (but I get errors):

<div tal:repeat="item python:here.list_chain()">
 <a class="gnawlink" href=""
    tal:condition="repeat/item/start"
    tal:attributes="href item/absolute_url">Previous</a>
 <a class="gnawlink" href=""
    tal:condition="repeat/item/end"
    tal:attributes="href item/absolute_url">Next</a>
</div>


Can someone help me?

Greetz Nico