<div>I would think this should be pretty easy in the PT itself, given what you've shared so far. But I'm still not quite there. Here's what I've got:</div>


<div>&nbsp;</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;span tal:repeat="bitem_id bitem_ids" tal:omit-tag=""&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;div tal:define="iter python:modules['ZTUtils'].Iterator(range(1000))"&gt; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;br tal:define="x iter/next" tal:replace="iter/number" /&gt;<br>


<div><br>
Now, I don't really want that &lt;br /&gt; tag there, because it's printing a number to screen that I don't want there. However, it only prints the number "1" twice, once for each product, when it should print 1 then 2, I would think. (I presume I should just take the tal:replace out and leave the definition, but it's still not incrementing!) Later in the script I have this:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="hidden" tal:attributes="value item/name; name python:'item_name_' + `x`"&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input type="hidden" tal:attributes="value item/id; name python:'item_number_' + `x`"&gt;<br>
<br>
and other similar lines. What I'm trying to effectuate is that the "x" gets replaced with an incremented number. Can you help just a little more?<br>
TIA,<br>
Tony<br>
<br>
-----Original Message-----<br>
From: Peter Bengtsson &lt;peter@fry-it.com&gt;<br>
To: tonylabarbara@aol.com<br>
Cc: zope@zope.org<br>
Sent: Mon, 30 Jul 2007 1:32 pm<br>
Subject: Re: [Zope] Increment In PT?<br>
<br>
</div>


<div id=AOLMsgPart_0_ead64ef0-a9a6-49b7-ac82-1a08bae09e94 style="FONT-SIZE: 12px; MARGIN: 0px; COLOR: #000; FONT-FAMILY: Tahoma, Verdana, Arial, Sans-Serif; BACKGROUND-COLOR: #fff">You can use the ZTUtils Iterator()&nbsp;<br>
&nbsp;<br>
&lt;div tal:define="iter python:modules['ZTUtils'].Iterator(range(1000))"&gt;&nbsp;<br>
&nbsp; &lt;br tal:define="dummy iter/next" tal:replace="iter/number" /&gt;&nbsp;<br>
&nbsp; &lt;br tal:define="dummy iter/next" tal:replace="iter/number" /&gt;&nbsp;<br>
&nbsp; &lt;br tal:define="dummy iter/next" tal:replace="iter/number" /&gt;&nbsp;<br>
&lt;/div&gt;&nbsp;<br>
&nbsp;<br>
Which might give you some freedom such as iter/Roman or iter/odd&nbsp;<br>
The above is practically the same as:&nbsp;<br>
&nbsp;<br>
&nbsp; &lt;br tal:repeat="i python:range(3)" tal:replace="i" /&gt;&nbsp;<br>
&nbsp;<br>
Generally, if you can, use a Python Script or something. The Iterator is/was used in Plone templates to increment the tab index.&nbsp;<br>
&nbsp;<br>
<A href="mailto:tonylabarbara@aol.com">tonylabarbara@aol.com</A> wrote:&nbsp;<br>
&gt; Hi;&nbsp;<br>
&gt; I´m trying to increment a variable in a page template. Here´s the &gt; general idea in my code:&nbsp;<br>
&gt; &gt; &lt;div metal:define-macro="main" tal:define="x python:0"&gt;&nbsp;<br>
&gt; &gt; &lt;tal:block tal:define="x python:x + 1"&gt;&nbsp;<br>
&gt; &lt;td&gt;&nbsp;<br>
&gt; &lt;input type="hidden" tal:attributes="value item/name; name &gt; python:'item_name_' + `x`"&gt;&nbsp;<br>
&gt; &gt; &gt; Now, all of that works...once. That is, it increments from 0 to 1, but &gt; not from 1 to 2! Each time I pass through the td element, I need it to &gt; increment. I tried putting the tal definition in the td, but then it &gt; didn´t even increment once! What do?&nbsp;<br>
&gt; TIA,&nbsp;<br>
&gt; Tony&nbsp;<br>
&gt; ------------------------------------------------------------------------&nbsp;<br>
&gt; AOL now offers free email to everyone. Find out more about what's free &gt; from AOL at *AOL.com* &lt;<A href="http://www.aol.com/?ncid=AOLAOF00020000000437" target=_blank>http://www.aol.com?ncid=AOLAOF00020000000437</A>&gt;.&nbsp;<br>
&gt; &gt; &gt; ------------------------------------------------------------------------&nbsp;<br>
&gt; &gt; _______________________________________________&nbsp;<br>
&gt; Zope maillist - <A href="mailto:Zope@zope.org">Zope@zope.org</A>&nbsp;<br>
&gt; <A href="http://mail.zope.org/mailman/listinfo/zope" target=_blank>http://mail.zope.org/mailman/listinfo/zope</A>&nbsp;<br>
&gt; ** No cross posts or HTML encoding! **&nbsp;<br>
&gt; (Related lists - &gt; <A href="http://mail.zope.org/mailman/listinfo/zope-announce" target=_blank>http://mail.zope.org/mailman/listinfo/zope-announce</A>&nbsp;<br>
&gt; <A href="http://mail.zope.org/mailman/listinfo/zope-dev" target=_blank>http://mail.zope.org/mailman/listinfo/zope-dev</A> )&nbsp;<br>
&nbsp;<br>
-- Peter Bengtsson,&nbsp;<br>
work <A href="http://www.fry-it.com/" target=_blank>www.fry-it.com</A>&nbsp;<br>
home <A href="http://www.peterbe.com/" target=_blank>www.peterbe.com</A>&nbsp;<br>
hobby <A href="http://www.issuetrackerproduct.com/" target=_blank>www.issuetrackerproduct.com</A>&nbsp;<br>
</div>
<!-- end of AOLMsgPart_0_ead64ef0-a9a6-49b7-ac82-1a08bae09e94 --><div class="AOLPromoFooter">
<hr style="margin-top:10px;" />
AOL now offers free email to everyone.  Find out more about what's free from AOL at <a href="http://www.aol.com?ncid=AOLAOF00020000000437" target="_blank"><b>AOL.com</b></a>.<br />
</div>