switch case with the node ID.

Author Message

Christine Romel

Wednesday 29 September 2004 1:37:46 am

Hii eveybody..

would u plzz check what's the prob. on that code??
sorry..but i'm new to EZ publish and need ur help..

what i need to do is:
check for the selected node..
get its ID..
make a switch case on that ID..
if ID matches case1: set variable1 = value1 & set var2=val2....etc..
and then when the folder is shosen to be shown..take its variables var1 & var2 which are $left & $right (nodes IDs) and show their content..

the prob.
when i choose any node nothing appears...
NB: the prob. is not in the showing way itself(the bla bla bla part in the above code)...

help..plzz
=============================================================

is the nodeChosen variable contains the whole node object?

{let nodeChosen = fetch(content, node, hash(node_id,$cn)) right=0 left=0 km=222 hy=227}

/*is there something called $node.id coz i wanna check the node by its ID*/

{switch name=ShowArticle match=$node.id}
{case match=222}
{set right = 1124}
{set left = 1125}
{/case}

{case match=227}
{set right = 1132}
{set left = 1133}
{/case}

{/switch}
{/let}


<!--************ That's the first (right)column************************-->

<td valign="top" width="250px">
{let col=fetch(content,tree, hash(parent_node_id,$right,limit,4, sort_by,array(priority, true())))}


bla bla blaaa...



<!--************ That's the second (left )column**********************************-->

<td valign="top" width="250px">
{let col=fetch(content,tree, hash(parent_node_id, $left,limit,4, sort_by,array(priority, true())))}


bla bla bla...

--------------------
i need it urgently..
i really appreciate ur help..

christine..

Frederik Holljen

Wednesday 29 September 2004 1:41:40 am

Try $node.node_id

To see all the variables of $node use: {$node|attribute(show)}.
It might be handy to print this list for future reference..

Christine Romel

Wednesday 29 September 2004 4:11:37 am

Hii Fredrek

well..i was able to get the node ID..
but still there's a problem:((
i made global var. called right & left and assigned them a value as initialization..
but when i change their values in the switch case..they are not shown..

{switch name=ShowArticle match=$:nodeChosen.node_id}
{case match=222}
{section}{set $right=1124}{/section}
{section}{set $left=1125}{/section}
{/case}
{/switch}

and then their values here..are taken by the global ones not the newly changed ones:((

{let col=fetch(content,tree, hash(parent_node_id,$right,limit,4, sort_by,array(priority, true())))}

================================
sorry for disturbtion..
thanx for ur help a lott..

christine

Frederik Holljen

Wednesday 29 September 2004 4:30:17 am

I think you are having a namespace problem. Remove the name= in the switch, and use $: to address the left and right variables.
You can also read the documentation page about namespaces http://ez.no/ez_publish/documentation/development/libraries/ez_template/basics/namespaces.

In other words, something like:

<{switch match=$:nodeChosen.node_id}
 {case match=222}
 {section}{set $:right=1124}{/section}
 {section}{set $:left=1125}{/section}
 {/case}
 {/switch}

Of course, this will only work if you do not open a new namespace in the let (using name=) defining the left and right variables.

Christine Romel

Wednesday 29 September 2004 6:06:21 am

ok..i solved the namespace prob..:D
but..do u know how would i call a variable using namespaces inside the new name space itself..!

4ex.this code..
{let nodeChosen=fetch(content,node,hash(node_id,$cn)) name='let'}
{switch name='chosen' match=$:nodeChosen.node_id }
{case match=222}
{let right=1124 left=1125 name='case'}{/let}
{/case}
...
{let col=fetch(content,tree, hash(..,***** need to put the $chosen:case:right*****variable here,),...)}
.
.
.
{/let}
{/switch}
{/let}
i wrote it as mentioned but didn't work!!

 

Frederik Holljen

Wednesday 29 September 2004 7:24:07 am

You open three namespaces here 'let', 'chosen' and 'case.
Therefore:


 {let col=fetch(content,tree, hash(..,***** need to put the $let:chosen:case:right*****variable here,),...)}

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 21:11:22
Script start
Timing: Jan 18 2025 21:11:22
Module start 'layout'
Timing: Jan 18 2025 21:11:22
Module start 'content'
Timing: Jan 18 2025 21:11:24
Module end 'content'
Timing: Jan 18 2025 21:11:24
Script end

Main resources:

Total runtime1.4680 sec
Peak memory usage4,096.0000 KB
Database Queries66

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0089 589.0391152.6250
Module start 'layout' 0.00890.0055 741.664139.4453
Module start 'content' 0.01441.4519 781.1094569.5078
Module end 'content' 1.46620.0018 1,350.617216.1641
Script end 1.4680  1,366.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2244160.0002
Check MTime0.00130.0886160.0001
Mysql Total
Database connection0.00080.056110.0008
Mysqli_queries1.383994.2669660.0210
Looping result0.00090.0584640.0000
Template Total1.422596.920.7113
Template load0.00180.124020.0009
Template processing1.420796.776220.7104
Template load and register function0.00020.011110.0002
states
state_id_array0.00190.130710.0019
state_identifier_array0.00260.173820.0013
Override
Cache load0.00180.12551140.0000
Sytem overhead
Fetch class attribute can translate value0.00070.047320.0003
Fetch class attribute name0.00210.141770.0003
XML
Image XML parsing0.00080.051720.0004
class_abstraction
Instantiating content class attribute0.00000.001690.0000
General
dbfile0.00090.0622160.0001
String conversion0.00000.000740.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
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
19content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
15content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/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: 47
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs