Problem with logical operator "contains"

Author Message

Tore Skobba

Thursday 06 November 2003 3:23:28 am

Solved it myself! See bottom for my solution.
Hi

I am making an tree menu where folders should be displayed differently from articles. In order to do this I fetch all child objects, and then try to decide what type the object is of. The code snippet is below here:
{section show=(1,19,25)|contains($:item.object.contentclass_id)}

Where (1,19,25) are my variuos folder content classes. However this does not work, the above is always true also for item that have a different contentclass_id than (1,19,25).. So I guess I might use the contains logics operator wrongly. Anyone who can see any errors?

See below for more code snippets:

{section loop=fetch(content,list,hash(parent_node_id,$node_obj.node_id))}
{section show=(1,19,25)|contains($:item.object.contentclass_id)}
FOLDER TYPE
{section-else}
NONE FOLDER TPE
{/section}

Cheers
Tore

SOLUTION

{section show=(1,19,25)|contains($:item.object.contentclass_id)}
is alway true. However, inserting "array" after "=" makes it work.

{section show=array(1,19,25)|contains($:item.object.contentclass_id)}

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 04:27:22
Script start
Timing: Jan 19 2025 04:27:22
Module start 'layout'
Timing: Jan 19 2025 04:27:22
Module start 'content'
Timing: Jan 19 2025 04:27:22
Module end 'content'
Timing: Jan 19 2025 04:27:22
Script end

Main resources:

Total runtime0.6969 sec
Peak memory usage4,096.0000 KB
Database Queries46

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 589.2734152.6406
Module start 'layout' 0.00770.0033 741.914139.4766
Module start 'content' 0.01100.6843 781.3906405.8984
Module end 'content' 0.69530.0016 1,187.28918.1250
Script end 0.6969  1,195.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.5726160.0002
Check MTime0.00160.2289160.0001
Mysql Total
Database connection0.00100.143810.0010
Mysqli_queries0.652093.5569460.0142
Looping result0.00040.0529440.0000
Template Total0.663695.220.3318
Template load0.00220.318520.0011
Template processing0.661494.903920.3307
Template load and register function0.00020.027410.0002
states
state_id_array0.00070.097010.0007
state_identifier_array0.00110.153620.0005
Override
Cache load0.00180.2609210.0001
Sytem overhead
Fetch class attribute can translate value0.00060.082810.0006
Fetch class attribute name0.00070.107510.0007
XML
Image XML parsing0.00010.017510.0001
class_abstraction
Instantiating content class attribute0.00000.000610.0000
General
dbfile0.00070.1014100.0001
String conversion0.00000.001640.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
1content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs