Forums / General / Check eq for several values in one section show

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

eZ debug

Timing: Jan 18 2025 11:20:55
Script start
Timing: Jan 18 2025 11:20:55
Module start 'content'
Timing: Jan 18 2025 11:20:55
Module end 'content'
Timing: Jan 18 2025 11:20:55
Script end

Main resources:

Total runtime0.7186 sec
Peak memory usage4,096.0000 KB
Database Queries208

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 588.9688180.8203
Module start 'content' 0.00580.5743 769.7891620.8984
Module end 'content' 0.58010.1385 1,390.6875337.0625
Script end 0.7186  1,727.7500 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.5797210.0002
Check MTime0.00160.2204210.0001
Mysql Total
Database connection0.00100.143910.0010
Mysqli_queries0.640389.10342080.0031
Looping result0.00190.25942060.0000
Template Total0.692796.420.3464
Template load0.00220.300320.0011
Template processing0.690596.092920.3453
Template load and register function0.00010.013610.0001
states
state_id_array0.00090.123410.0009
state_identifier_array0.00130.179120.0006
Override
Cache load0.00190.2630440.0000
Sytem overhead
Fetch class attribute can translate value0.00100.144440.0003
Fetch class attribute name0.00140.192990.0002
XML
Image XML parsing0.00130.176240.0003
class_abstraction
Instantiating content class attribute0.00000.0064110.0000
General
dbfile0.00220.3012340.0001
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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