RE: [Zope] How do you increment a variable?
-----Original Message----- From: Tony McDonald [mailto:tony.mcdonald@ncl.ac.uk] Sent: Thursday, July 29, 1999 10:11 AM To: Zope List Subject: [Zope] How do you increment a variable?
I am having a *bad* day, I don't seem to be able to get *any* of my Zope stuff to work today :(
I can't get this to work. <dtml-let counter="1"> Counter:<dtml-var counter>, <dtml-var counter="counter+1"> (Line A) <dtml-var counter> </dtml-let>
You can't do assignments inside Python expressions. Of the top of my head, you might try: <dtml-with "_(counter=1)"--> <dtml-var counter> <dtml-let counter="counter+1"> <dtml-var counter> </dtml-let> </dtml-with> -Michel
Cheers for the reply Michel,
You can't do assignments inside Python expressions.
ahhhh...
Of the top of my head, you might try:
<dtml-with "_(counter=1)"-->
typo, --> should be >
<dtml-var counter> <dtml-let counter="counter+1"> <dtml-var counter> </dtml-let> </dtml-with>
-Michel
This does work, I then tried to extend it with <dtml-with "_(counter=1)"> <dtml-var counter> <dtml-in "_.range(0,10)"> <dtml-let counter="counter+1"> <dtml-var counter> </dtml-let> </dtml-in> </dtml-with> and got 1 2 2 2 2 2 2 2 2 2 2. Is that because the <dtml-in> tag sets up another name space? ------ Dr Tony McDonald, FMCC, Networked Learning Environments Project http://nle.ncl.ac.uk/ The Medical School, Newcastle University Tel: +44 191 222 5888 Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
participants (2)
-
Michel Pelletier -
Tony McDonald