Forums / Setup & design / Problem with {section show=ne(...)}

Problem with {section show=ne(...)}

Author Message

Tristan Koen

Thursday 07 August 2003 3:16:12 pm

I am having a problem that is driving me absolutely crazy. If there is anyone out there that can see what I am doing wrong, I would really appreciate it.

In my code I set a variable
{default myVar=47} where 47 is a specific node_id I want to exclude.

My code then goes:

{let folder_list=fetch(content, list, hash(parent_node_id, 47, sort_by, array(array(priority))))}
{section name=Folder loop=$folder_list}
<h1>{$Folder:item.name}</h1>

{let item_list=fetch(content, tree, hash(parent_node_id, $Folder:item.node_id, class_filter_type,exclude, class_filter_array,array(1), sort_by,array(array(published,false()))))}

{section loop=$Folder:item_list show=ne($:item.node_id,$myVar)}
Item node id: {$Folder:item.node_id} <br />
Latest node id: {$myVar} <br />

{/section}
{/let}

{/section}
{/let}

For some reason, I cannot get the {section show=ne(...)} bit to work. That particular node (it is an article) keeps getting displayed.

I am now getting desperate.

Regards,

Tristan

Jan Borsodi

Thursday 07 August 2003 10:32:37 pm

Try running the variable trough the ne operator instead of using it as parameters.
{section loop=$Folder:item_list show=$Folder:item.node_id|ne($myVar)}

Also look for errors and warnings in the debug list, they can give you clues to what is wrong.

--
Amos

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

Tristan Koen

Friday 08 August 2003 12:36:49 am

Hi Jan,

Thanks for the suggestion, but it still doesn't work.
There are no debug warnings or errors.
The cache has been cleared.

I have pasted the full source code below:
{default latest_item_id=0}

{* Fetch the latest article from the tree and assign its node_id to $latest_item_id *}
{let latest_article=fetch('content',tree,hash(parent_node_id, 47, sort_by,array(published,false())))}
{section loop=$latest_article max=1}
{set latest_item_id=$:item.node_id}
<h2>{$:item.data_map.title.content}</h2>
{$:item.data_map.intro.content.output.output_text}
<p><a href={concat('content/view/full/',$:item.node_id)|ezurl}>[ Read More... ]</a></p>
{/section}
{/let}

{* Fetch the list of folders contained in the library folder (node_id=47) *}
{let folder_list=fetch(content,list,hash(parent_node_id,47,sort_by,array(array(priority))))}
{section name=Folder loop=$folder_list}
<h1>{$Folder:item.name}</h1>

{* Fetch a list of all articles contained in each library folder. Exclude the article with node_id = $latest_item_id *}
{let item_list=fetch(content,tree,hash(parent_node_id,$Folder:item.node_id,class_filter_type,exclude,class_filter_array,array(1),sort_by,array(array(published,false()))))}
{section loop=$Folder:item_list max=1 show=$:item.node_id|ne($latest_item_id)}
Latest story id is {$latest_item_id}<br />
Current story id is {$:item.node_id}<br />
<h2>{$:item.data_map.title.content}</h2>
{$:item.data_map.intro.content.output.output_text}
<p><a href={concat('content/view/full/',$:item.node_id)|ezurl}>[ Read More... ]</a></p>
{/section}
<ul>
{section loop=$Folder:item_list offset=1}
<li><a href={concat('content/view/full/',$:item.node_id)|ezurl}>{$:item.data_map.title.content}</a></li>
{/section}
</ul>

{/let}
{/section}

{/let}

If anybody can see something wrong here, please PLEASE let me know.

Regards,

Tristan

Paul Forsyth

Friday 08 August 2003 1:52:47 am

Using 'show=ne($a,$b)' should work.

Can you perform some simple debugging on the values being tested.

Before your line:
{section loop=$Folder:item_list show=ne($Folder:item.node_id,$myVar)}

Try showing {$Folder:item.node_id} and {$myVar} so you can see the values before they are tested... This may help you see where the code logic is going wrong.

paul

Tristan Koen

Friday 08 August 2003 4:21:13 am

Sorry... I posted the wrong version of the code. I was playing with trying different namespaces and left some garbage in. I have corrected the code in the messages above.

The change is simple: I should have been comparing $latest_item_id with $:item.node_id instead of with $Folder:item.node_id (in my original code it was $Folder:sectionname:item.node_id but I dropped the section name).

It appears that the problem lies with variable scope rather than the ne() operator.
$:item.node_id appears to be null in the section declaration. It is only assigned within the {section}.

Is this the correct behaviour? This may be in the docs, but I couldn't find it...

Armed with this knowledge, I can make the code work by embedding a separate {section} within my looping {section}. Is there a better way to do this?

eZ debug

Timing: Jan 18 2025 15:50:11
Script start
Timing: Jan 18 2025 15:50:11
Module start 'content'
Timing: Jan 18 2025 15:50:13
Module end 'content'
Timing: Jan 18 2025 15:50:13
Script end

Main resources:

Total runtime1.5196 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 588.8438180.8359
Module start 'content' 0.00771.3918 769.6797618.2656
Module end 'content' 1.39950.1200 1,387.9453337.3984
Script end 1.5195  1,725.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2427210.0002
Check MTime0.00140.0919210.0001
Mysql Total
Database connection0.00080.053510.0008
Mysqli_queries1.442794.93912020.0071
Looping result0.00180.11692000.0000
Template Total1.486497.820.7432
Template load0.00180.119520.0009
Template processing1.484697.696720.7423
Template load and register function0.00020.015310.0002
states
state_id_array0.00110.072310.0011
state_identifier_array0.00140.095320.0007
Override
Cache load0.00160.1046810.0000
Sytem overhead
Fetch class attribute can translate value0.00110.069640.0003
Fetch class attribute name0.00100.064160.0002
XML
Image XML parsing0.00110.069240.0003
class_abstraction
Instantiating content class attribute0.00000.000860.0000
General
dbfile0.00230.1483280.0001
String conversion0.00000.000430.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
18content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
14content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 40
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs