Using TAL and ZPT, I would like to define a global variable myVar, and then later on in the page add 1 to myVar, e.g. myVar = myVar + 1. How can I modify a variable in TAL? I know how to modify a tag using REPLACE, ATTRIBUTES etc., but I want to modify a variable that I have previously defined. __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com
On Thu, Aug 21, 2003 at 03:16:04PM -0700, Jonathan Mark wrote:
Using TAL and ZPT, I would like to define a global variable myVar, and then later on in the page
add 1 to myVar, e.g. myVar = myVar + 1.
How can I modify a variable in TAL? I know how to modify a tag using REPLACE, ATTRIBUTES etc., but I want to modify a variable that I have previously defined.
for math you can use a tales python expression... <tal:define="foo python:foo + 1"> -- Paul Winkler http://www.slinkp.com Look! Up in the sky! It's FORGETFUL RADIOCACTIVE MAJOR! (random hero from isometric.spaceninja.com)
On Thursday, August 21, 2003, at 06:16 PM, Jonathan Mark wrote:
Using TAL and ZPT, I would like to define a global variable myVar, and then later on in the page
add 1 to myVar, e.g. myVar = myVar + 1.
How can I modify a variable in TAL? I know how to modify a tag using REPLACE, ATTRIBUTES etc., but I want to modify a variable that I have previously defined.
Just re-define the variable in terms of the old one. Here's a quick example: <div tal:define="xx python:4"> This is the original: <span tal:replace="xx">orig</span><br> This is the new: <span tal:define="xx python:xx*2" tal:replace="xx">orig</span><br> </div> ___/ / __/ / ____/ Ed Leafe http://leafe.com/ http://opentech.leafe.com
Jonathan Mark wrote at 2003-8-21 15:16 -0700:
Using TAL and ZPT, I would like to define a global variable myVar, and then later on in the page
add 1 to myVar, e.g. myVar = myVar + 1.
How can I modify a variable in TAL?
You make a new definition: ... tal:define="global myVar python: myVar + 1" ... The TAL specification tells you... (see the Zope Book, 2.6 edition, on Zope.org). Dieter
participants (4)
-
Dieter Maurer -
Ed Leafe -
Jonathan Mark -
Paul Winkler