Try this way:<br><br><tal:loop repeat="item bitems"><br> <input type="hidden" tal:attributes="value item/name; name string:item_name_${repeat/item/number}"><br> <input type="hidden" tal:attributes="value item/id; name string:item_number_${repeat/item/number}">
<br></tal:loop><br><br>Zenrique.<br><br><div><span class="gmail_quote">2007/7/30, Peter Bengtsson <<a href="mailto:peter@fry-it.com">peter@fry-it.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You should now have all the parts.<br>Instead of iterating over python:range(1000) do it on bitem_ids instead.<br><br>You don't have to use a <br /> tag. You can use<br><input tal:attributes="value iter/number" />
<br>if you want.<br>You increment it by calling tal:iter/next whichever way you do it.<br><br><a href="mailto:tonylabarbara@aol.com">tonylabarbara@aol.com</a> wrote:<br>> I would think this should be pretty easy in the PT itself, given what
<br>> you've shared so far. But I'm still not quite there. Here's what I've got:<br>><br>> <span tal:repeat="bitem_id bitem_ids" tal:omit-tag=""><br>> <div tal:define="iter
<br>> python:modules['ZTUtils'].Iterator(range(1000))"><br>> <br tal:define="x iter/next" tal:replace="iter/number" /><br>><br>> Now, I don't really want that <br /> tag there, because it's printing a
<br>> number to screen that I don't want there. However, it only prints the<br>> number "1" twice, once for each product, when it should print 1 then 2,<br>> I would think. (I presume I should just take the tal:replace out and
<br>> leave the definition, but it's still not incrementing!) Later in the<br>> script I have this:<br>><br>> <input type="hidden" tal:attributes="value item/name;<br>> name python:'item_name_' + `x`">
<br>> <input type="hidden" tal:attributes="value item/id; name<br>> python:'item_number_' + `x`"><br>><br>> and other similar lines. What I'm trying to effectuate is that the "x"
<br>> 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 <<a href="mailto:peter@fry-it.com">
peter@fry-it.com</a>><br>> To: <a href="mailto:tonylabarbara@aol.com">tonylabarbara@aol.com</a><br>> Cc: <a href="mailto:zope@zope.org">zope@zope.org</a><br>> Sent: Mon, 30 Jul 2007 1:32 pm<br>> Subject: Re: [Zope] Increment In PT?
<br>><br>> You can use the ZTUtils Iterator()<br>><br>> <div tal:define="iter python:modules['ZTUtils'].Iterator(range(1000))"><br>> <br tal:define="dummy iter/next" tal:replace="iter/number" />
<br>> <br tal:define="dummy iter/next" tal:replace="iter/number" /><br>> <br tal:define="dummy iter/next" tal:replace="iter/number" /><br>> </div><br>
><br>> Which might give you some freedom such as iter/Roman or iter/odd<br>> The above is practically the same as:<br>><br>> <br tal:repeat="i python:range(3)" tal:replace="i" />
<br>><br>> Generally, if you can, use a Python Script or something. The Iterator<br>> is/was used in Plone templates to increment the tab index.<br>><br>> <a href="mailto:tonylabarbara@aol.com">tonylabarbara@aol.com
</a> <mailto:<a href="mailto:tonylabarbara@aol.com">tonylabarbara@aol.com</a>> wrote:<br>> > Hi;<br>> > Iīm trying to increment a variable in a page template. Hereīs the ><br>> general idea in my code:
<br>> > > <div metal:define-macro="main" tal:define="x python:0"><br>> > > <tal:block tal:define="x python:x + 1"><br>> > <td><br>> > <input type="hidden" tal:attributes="value item/name; name >
<br>> python:'item_name_' + `x`"><br>> > > > Now, all of that works...once. That is, it increments from 0 to<br>> 1, but > not from 1 to 2! Each time I pass through the td element, I<br>
> need it to > increment. I tried putting the tal definition in the td,<br>> but then it > didnīt even increment once! What do?<br>> > TIA,<br>> > Tony<br>> > ------------------------------------------------------------------------
<br>> > AOL now offers free email to everyone. Find out more about what's<br>> free > from AOL at *AOL.com*<br>> <<a href="http://www.aol.com?ncid=AOLAOF00020000000437">http://www.aol.com?ncid=AOLAOF00020000000437
</a><br>> <<a href="http://www.aol.com/?ncid=AOLAOF00020000000437">http://www.aol.com/?ncid=AOLAOF00020000000437</a>>>.<br>> > > ><br>> ------------------------------------------------------------------------
<br>> > > _______________________________________________<br>> > Zope maillist - <a href="mailto:Zope@zope.org">Zope@zope.org</a> <mailto:<a href="mailto:Zope@zope.org">Zope@zope.org</a>><br>> >
<a href="http://mail.zope.org/mailman/listinfo/zope">http://mail.zope.org/mailman/listinfo/zope</a><br>> > ** No cross posts or HTML encoding! **<br>> > (Related lists - > <a href="http://mail.zope.org/mailman/listinfo/zope-announce">
http://mail.zope.org/mailman/listinfo/zope-announce</a><br>> > <a href="http://mail.zope.org/mailman/listinfo/zope-dev">http://mail.zope.org/mailman/listinfo/zope-dev</a> )<br>><br>> -- Peter Bengtsson,<br>> work
<a href="http://www.fry-it.com">www.fry-it.com</a> <<a href="http://www.fry-it.com/">http://www.fry-it.com/</a>><br>> home <a href="http://www.peterbe.com">www.peterbe.com</a> <<a href="http://www.peterbe.com/">
http://www.peterbe.com/</a>><br>> hobby <a href="http://www.issuetrackerproduct.com">www.issuetrackerproduct.com</a> <<a href="http://www.issuetrackerproduct.com/">http://www.issuetrackerproduct.com/</a>><br>> ------------------------------------------------------------------------
<br>> AOL now offers free email to everyone. Find out more about what's free<br>> from AOL at *AOL.com* <<a href="http://www.aol.com?ncid=AOLAOF00020000000437">http://www.aol.com?ncid=AOLAOF00020000000437</a>
>.<br><br>--<br>Peter Bengtsson,<br>work <a href="http://www.fry-it.com">www.fry-it.com</a><br>home <a href="http://www.peterbe.com">www.peterbe.com</a><br>hobby <a href="http://www.issuetrackerproduct.com">www.issuetrackerproduct.com
</a><br>_______________________________________________<br>Zope maillist - <a href="mailto:Zope@zope.org">Zope@zope.org</a><br><a href="http://mail.zope.org/mailman/listinfo/zope">http://mail.zope.org/mailman/listinfo/zope
</a><br>** No cross posts or HTML encoding! **<br>(Related lists -<br> <a href="http://mail.zope.org/mailman/listinfo/zope-announce">http://mail.zope.org/mailman/listinfo/zope-announce</a><br> <a href="http://mail.zope.org/mailman/listinfo/zope-dev">
http://mail.zope.org/mailman/listinfo/zope-dev</a> )<br></blockquote></div><br>