At 2:55 pm +0100 7/6/00, Chris Withers wrote:
>josh on wrote:
>>  can I set a local variable in zope on a dtml page
>>  <dtml-var variablename = 1>
>
>Yup:
>
><dtml-call "REQUEST.set('variablename',1)">
>
>Nice syntax, huh? ;-)
>
>Chris

now now :)

(tested)

<dtml-let variablename="1">
blah blah blah ... ie the scope of the variable
<dtml-var variablename>
</dtml-let>

don't fall into the trap of doing this
<dtml-let variablename="I am a string">
blah blah blah ... ie the scope of the variable
<dtml-var variablename>
</dtml-let>

'cos Zope won't let you enter it (it thinks that the 'I' is a 
variable name). Remember that anything in " " is evaluated as a 
Python expression...

try this instead
<dtml-let variablename="'I am a string'">
blah blah blah ... ie the scope of the variable
<dtml-var variablename>
</dtml-let>

You can have multiple variables set too...
<dtml-let variablename="'I am a string'" bloot="1">
blah blah blah ... ie the scope of the variable
<dtml-var variablename> :: <dtml-var bloot>
</dtml-let>

See lib/python/DocumentTemplate/DT_Let.py for more details...

hth
tone


------
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

_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to