Forums / Setup & design / cond() / is_set combination

cond() / is_set combination

Author Message

Vivienne van Velzen

Wednesday 22 October 2003 3:56:56 am

Hi,

I'm trying to do the following:

{let name=myspace
x=cond(is_set($somevar), $somevar, 0)}
{$myspace:x}
{/let}

However, I get an error that $somevar is unknown:
Unknown template variable 'somevar' in namespace 'myroot:NodeView:NodeView'

x does get the value of $somevar, but seeing as this variable is unknown....
($somevar would be passed by the calling template).

If I try x=cond(is_set($somevar),1,0), x gets the value 0 and no error message is shown.
What I don't get is that the parser looks at the if-part when the condition is false (at least, I think that's what's wrong here).
Can anyone tell me if this is a bug, or am I doing something wrong?
TIA,

Vivienne