[Zope] Increment In PT?
Peter Bengtsson
peter at fry-it.com
Mon Jul 30 13:32:22 EDT 2007
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 at 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 at 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
More information about the Zope
mailing list