[Zope] assignment problems

Martijn Pieters mj@digicool.com
Tue, 4 Jan 2000 06:22:03 -0500


> > With above corrections, you're code should read:
> 
> This worked. Now, what if I need to assign again to the same variable:
> 
> <dtml-let Size="'big'">
> <dtml-let Size="'bi'">
> <dtml-if "Size=='big'"><h1></dtml-if>
> Hello.
> <dtml-if "Size=='big'"></h1></dtml-if>
> </dtml-let>
> 
> It complains about let tag not being closed. Do I need to 
> nest let tags?
> It sounds silly...

I generally use the let tag for assigning more complex expressions to a
variable. You cannot indeed change them without nesting let tags.

However, you can lever the REQUEST object for this kind of thing:

  <dtml-call "REQUEST.set('Size', 'big')">
  <dtml-call "REQUEST.set('Size', 'bi')">
  <dtml-if "Size=='big'"><h1></dtml-if>
  Hello.
  <dtml-if "Size=='big'"></h1></dtml-if>

Now, 'Size' is found in the REQUEST object, and there the value of
'Size' can be modified.

-- 
Martijn Pieters, Software Engineer 
| Digital Creations http://www.digicool.com 
| Creators of Zope      http://www.zope.org 
| mailto:mj@digicool.com       ICQ: 4532236
| PGP:
http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 
-------------------------------------------