For loops in dtml
Anyone know how I can do the equivalent of the following in dtml: for (int i=0; i<count; i++) { ...stuff... } or even int i=0; while (i<count) { ..stuff.. i++; } cheers, Chris
The range function is probably what you need: <dtml-in "_.range(1,100,5)"> <dtml-var sequence-item> </dtml-in> ..gives.. 1 6 11 16 21 26 31 36 41 46 51 56 61 66 71 76 81 86 91 96 Cheers, Shalabh ____________________________________________
print reduce(lambda c,d:chr(ord(d)-2)+c, '>pk0qe0nrurBjdcncju>\"kfgxtwvcjE\"jdcncjU\014')
----- Original Message ----- From: Chris Withers <chrisw@nipltd.com> To: Zope Mailing List <zope@zope.org> Sent: Wednesday, February 23, 2000 9:48 PM Subject: [Zope] For loops in dtml
Anyone know how I can do the equivalent of the following in dtml:
for (int i=0; i<count; i++) { ...stuff... }
or even
int i=0; while (i<count) { ..stuff.. i++; }
cheers,
Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Hi, Chris Something like the following should get you going: <dtml-call "REQUEST.set('count',10)"> <dtml-in "_.range(count)"> <dtml-var sequence-item> </dtml-in> Regards, -- Jim Washington Chris Withers wrote:
Anyone know how I can do the equivalent of the following in dtml:
for (int i=0; i<count; i++) { ...stuff... }
or even
int i=0; while (i<count) { ..stuff.. i++; }
cheers,
Chris
On Wed, Feb 23, 2000 at 04:18:20PM +0000, Chris Withers wrote:
Anyone know how I can do the equivalent of the following in dtml:
for (int i=0; i<count; i++) { ...stuff... }
You need to learn Python :-) <dtml-in "_.range(count)"> stuff </dtml-in> []s, |alo +---- -- I am Lalo of deB-org. You will be freed. Resistance is futile. http://www.webcom.com/lalo mailto:lalo@webcom.com pgp key in the web page Debian GNU/Linux --- http://www.debian.org Brazil of Darkness -- http://zope.gf.com.br/BroDar
participants (4)
-
Chris Withers -
Jim Washington -
Lalo Martins -
Shalabh Chaturvedi