Forum OpenACS Q&A: creating a onerow template variable

Collapse
Posted by robert parker on
Hi

I want to create a structured templating variable so that I can do:

<if @props.field1@ eq 0>
<if @props.field2@ eq 0>
etc

I've used template::multirow to create structured variables for use within <multiple> but how do I create a "onerow" variable ? (./doc/acs-templating/tagref/variable.html seems to imply such a thing as a "onerow" exists)

Note that I dont want to read a database to initialise @props.

thanks
Robert

Collapse
Posted by Dave Bauer on
A onerow is really an array.

So in your tcl file you can do

array set props [field1 value field2 value]
or
set props(field1) value

and then refer to it in the adp as @props.field1@ without any additional tags.

Collapse
Posted by robert parker on
oh that's really obvious *blush*, thanks for the quick reply anyway