Use ZPT repeat variables (http://www.plope.com/Books/2_7Edition/AdvZPT.stx#2-3).


2007/7/30, Peter Bengtsson < peter@fry-it.com>:
You can use the ZTUtils Iterator()


<div tal:define="iter python:modules['ZTUtils'].Iterator(range(1000))">
   <br tal:define="dummy iter/next" tal:replace="iter/number" />
   <br tal:define="dummy iter/next" tal:replace="iter/number" />
   <br tal:define="dummy iter/next" tal:replace="iter/number" />
</div>

Which might give you some freedom such as iter/Roman or iter/odd
The above is practically the same as:

   <br tal:repeat="i python:range(3)" tal:replace="i" />

Generally, if you can, use a Python Script or something. The Iterator
is/was used in Plone templates to increment the tab index.

tonylabarbara@aol.com wrote:
> Hi;
> Iīm trying to increment a variable in a page template. Hereīs the
> general idea in my code:
>
> <div metal:define-macro="main" tal:define="x python:0">
>
> <tal:block tal:define="x python:x + 1">
> <td>
> <input type="hidden" tal:attributes="value item/name; name
> python:'item_name_' + `x`">
>
>
> Now, all of that works...once. That is, it increments from 0 to 1, but
> not from 1 to 2! Each time I pass through the td element, I need it to
> increment. I tried putting the tal definition in the td, but then it
> didnīt even increment once! What do?
> TIA,
> Tony
> ------------------------------------------------------------------------
> AOL now offers free email to everyone. Find out more about what's free
> from AOL at *AOL.com* < http://www.aol.com?ncid=AOLAOF00020000000437>.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Zope maillist  -   Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )