Try this way:

<tal:loop repeat="item bitems">
    <input type="hidden" tal:attributes="value item/name; name
string:item_name_${repeat/item/number}">
    <input type="hidden" tal:attributes="value item/id; name
string:item_number_${repeat/item/number}">
</tal:loop>

Zenrique.

2007/7/30, Peter Bengtsson <[EMAIL PROTECTED]>:
>
> You should now have all the parts.
> Instead of iterating over python:range(1000) do it on bitem_ids instead.
>
> You don't have to use a <br /> tag. You can use
> <input tal:attributes="value iter/number" />
> if you want.
> You increment it by calling tal:iter/next whichever way you do it.
>
> [EMAIL PROTECTED] wrote:
> > 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:
> >
> >       <span tal:repeat="bitem_id bitem_ids" tal:omit-tag="">
> >        <div tal:define="iter
> > python:modules['ZTUtils'].Iterator(range(1000))">
> >         <br tal:define="x iter/next" tal:replace="iter/number" />
> >
> > Now, I don't really want that <br /> 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:
> >
> >                 <input type="hidden" tal:attributes="value item/name;
> > name python:'item_name_' + `x`">
> >                 <input type="hidden" tal:attributes="value item/id; name
> > python:'item_number_' + `x`">
> >
> > 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?
> > TIA,
> > Tony
> >
> > -----Original Message-----
> > From: Peter Bengtsson <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]
> > Cc: zope@zope.org
> > Sent: Mon, 30 Jul 2007 1:32 pm
> > Subject: Re: [Zope] Increment In PT?
> >
> > 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.
> >
> > [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 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
> > <http://www.aol.com/?ncid=AOLAOF00020000000437>>.
> >  > > >
> > ------------------------------------------------------------------------
> >  > > _______________________________________________
> >  > Zope maillist - Zope@zope.org <mailto: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 <http://www.fry-it.com/>
> > home www.peterbe.com <http://www.peterbe.com/>
> > hobby www.issuetrackerproduct.com <http://www.issuetrackerproduct.com/>
> > ------------------------------------------------------------------------
> > 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>.
>
> --
> 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 )
>
_______________________________________________
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 )

Reply via email to