Check eq for several values in one section show

Author Message

Valentin Svelland

Monday 27 October 2003 5:51:01 am

Is it possible to make one 'section show' check if equal on multiple values? (I'd like to do something like this - look under). Or do I have to write a section show for each and every value?

{section show=$node.node_id|eq(1124|1156|1157|1152|etc)}
<h1>Members</h1>
{/section}

Paul Forsyth

Monday 27 October 2003 5:57:20 am

See:

http://ez.no/developer/ez_publish_3/documentation/development/libraries/ez_template/operators/logical_handling

You could write:

{let x=$node.node_id}

{section show=or( $x|eq(1124), $x|eq(1156), $x|eq(1157) )}
<h1>Members</h1>
{/section}

{/let}

I used a {let} to simplify the code. Take a look at the documentation for other examples.

paul

Valentin Svelland

Monday 27 October 2003 6:59:58 am

Thanks Paul! :)

Paul Forsyth

Monday 27 October 2003 7:03:40 am

Just remembed a better way :)

{switch match=$node.node_id}
{case in=array(1124,1156,1157,1152)}
<h1>Members</h1>
{/case}
{/switch}

Might be better depending on what you want to do but the code is far neater.

paul

Valentin Svelland

Wednesday 29 October 2003 12:50:39 am

Thanks again, Paul!!! :D

Jan Borsodi

Wednesday 29 October 2003 2:39:24 am

You can also use the contains operator to see if a value exists in an array.

{section show=array(1124,1156,1157)|contains($x)}
<h1>Members</h1>
{/section}

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Paul Forsyth

Wednesday 29 October 2003 2:49:48 am

Of course, much neater!

paul

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 18 2025 15:54:49
Script start
Timing: Jan 18 2025 15:54:49
Module start 'layout'
Timing: Jan 18 2025 15:54:49
Module start 'content'
Timing: Jan 18 2025 15:54:50
Module end 'content'
Timing: Jan 18 2025 15:54:50
Script end

Main resources:

Total runtime0.7283 sec
Peak memory usage4,096.0000 KB
Database Queries71

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.1719152.6406
Module start 'layout' 0.00650.0031 741.812539.4766
Module start 'content' 0.00960.7173 781.2891615.8047
Module end 'content' 0.72700.0013 1,397.093816.1250
Script end 0.7283  1,413.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4537160.0002
Check MTime0.00130.1748160.0001
Mysql Total
Database connection0.00070.093410.0007
Mysqli_queries0.657990.3236710.0093
Looping result0.00070.0996690.0000
Template Total0.698195.920.3491
Template load0.00170.238020.0009
Template processing0.696495.612920.3482
Template load and register function0.00020.026110.0002
states
state_id_array0.00060.086210.0006
state_identifier_array0.00060.086320.0003
Override
Cache load0.00150.2076440.0000
Sytem overhead
Fetch class attribute can translate value0.00080.105730.0003
Fetch class attribute name0.00150.201190.0002
XML
Image XML parsing0.00340.463030.0011
class_abstraction
Instantiating content class attribute0.00000.0028110.0000
General
dbfile0.00330.4560230.0001
String conversion0.00000.001140.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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs