Share » Forums » General » switch case with the node ID.

switch case with the node ID.

switch case with the node ID.

Wednesday 29 September 2004 1:37:46 am - 5 replies

Author Message

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,),...)}

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu