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.

eZ debug

Timing: Jan 19 2025 02:22:20
Script start
Timing: Jan 19 2025 02:22:20
Module start 'layout'
Timing: Jan 19 2025 02:22:20
Module start 'content'
Timing: Jan 19 2025 02:22:22
Module end 'content'
Timing: Jan 19 2025 02:22:22
Script end

Main resources:

Total runtime1.4516 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 589.0547152.6094
Module start 'layout' 0.00440.0025 741.664139.4141
Module start 'content' 0.00691.4430 781.0781583.7344
Module end 'content' 1.44990.0016 1,364.812512.5000
Script end 1.4515  1,377.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2321160.0002
Check MTime0.00130.0918160.0001
Mysql Total
Database connection0.00060.044010.0006
Mysqli_queries1.395496.1287620.0225
Looping result0.00070.0463600.0000
Template Total1.415097.520.7075
Template load0.00210.147620.0011
Template processing1.412997.331620.7064
Template load and register function0.00020.012710.0002
states
state_id_array0.00220.151410.0022
state_identifier_array0.00120.084320.0006
Override
Cache load0.00180.1236250.0001
Sytem overhead
Fetch class attribute can translate value0.00080.056830.0003
Fetch class attribute name0.00080.056560.0001
XML
Image XML parsing0.00130.087330.0004
class_abstraction
Instantiating content class attribute0.00000.000760.0000
General
dbfile0.00100.0715220.0000
String conversion0.00000.000440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 17
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs