Test multiple values

Author Message

Mateo Barahona

Wednesday 14 February 2007 1:04:03 am

I want to use the if statement of eZ publish, but i found nowhere how to test multiple values.
In php it would be :
if(($var=='test')||($var=='test2'))

How can i do that with the template script?

Thanks

Xavier Serna

Wednesday 14 February 2007 1:48:03 am

Hi Mateo,

you have available logical operators for this. In particular, your code:

if(($var=='test')||($var=='test2'))

would be

{if or($var|eq('test'),$var|eq('test2'))}

I recommend you to consult the reference docs that are so useful for questions like this.

http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/logical_operations

hope this helps!

--
Xavier Serna
eZ Publish Certified Developer
Departament de Software
Microblau S.L. - http://www.microblau.net
+34 937 466 205

Mateo Barahona

Wednesday 14 February 2007 1:51:06 am

I consulted the reference doc, but there are no examples of this, so it was not that simple :-)

Thanks!!!

Kristof Coomans

Wednesday 14 February 2007 2:30:55 am

Hi Mateo

Maybe this page can help you getting used to the template language: http://ezpedia.org/wiki/en/ez/template_language_for_php_developers

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.