[Zope] Newbie DTML: How do you just declair a veriable.

Stephen Pitts smpitts@midsouth.rr.com
Wed, 19 Apr 2000 11:30:36 -0500


On Wed, Apr 19, 2000 at 11:03:21AM -0400, Coleman, Bryan wrote:
> 
> I am sure that this has been asked before but for some reason I cant find
> the answer. 
> 
> I am developing a small application and in part of it I want one page to
> recursively call itself and display a new sub-page depending on which link
> was clicked on. I am trying to just create a variable that I can set to the
> new method but I always get an error. 
> 
> How do you just make an arbitrary variable.
> 
> I tried <dtml-var somename> = <dtml-var somemethod> and it did not like that
> complained about there not being a somename well that's what I am trying to
> make.
> 

The easiest way is to use REQUEST.set:
<dtml-call "REQUEST.set('myvariable','myvalue')">

Another way to do it is to use dtml-let. This is "cleaner" if you will
only need the variable for a short time.
<dtml-let nums="(4,5,6)">
  nums forward:
  <dtml-in nums><dtml-var sequence-item> </dtml-in>
  nums backward:
  <dtml-in nums reverse><dtml-var sequence-item> </dtml-in>
</dtml-let>

Nums only exists between the two <dtml-let statements>.
-- 
Stephen Pitts
smpitts@midsouth.rr.com