[ZPT] Conditionals

Chris Withers lists at simplistix.co.uk
Wed Mar 24 09:10:25 EST 2004


Michael Bond wrote:

> 
> Is it possible to combine various conditionals into 1 tal:condition 
> expression?
> 
> If i wanted to do:
> 
> if (var1 == 'this' && var2 =='that')
> 
> Is it possible without using a series of <span>'s
> 
> I've tried the following, but the syntax is obviously not correct:
> 
> tal:condition="python:var1 == 'this' and python:var2 == 'that'"

...close ;-)

tal:condition="python:var1 == 'this' and var2 == 'that'"

> Also, how complex can it be made?

As complex as you want!


> if ((var1 == 'this' && var2 =='that') || var3 == 'another')

tal:condition="python:((var1 == 'this' and var2 =='that') or var3 == 'another')"

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk




More information about the ZPT mailing list