Forums / Setup & design / Trouble with using names in nested sections
Lance Leger
Monday 07 July 2003 12:46:03 pm
Hello, I'm having trouble calling data from one section in another section... Is this possible?
{section name=One loop=fetch(content,tree,hash(parent_node_id,$node.node_id,class_filter_type,include,class_filter_array,array(1)))} {section name=Two loop=5} {$One:node.name} {/section}{/section}
Any ideas?
Bruce Morrison
Monday 07 July 2003 3:24:32 pm
Try
{section name=One loop=fetch(content,tree,hash(parent_node_id,$node.node_id,class_filter_type,include,class_filter_array,array(1)))} {section name=Two loop=5} {$One:item.name} <-- This line {/section}{/section}
Cheers BrucedesignIT
My Blog: http://www.stuffandcontent.com/ Follow me on twitter: http://twitter.com/brucemorrison Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish
Monday 07 July 2003 10:04:24 pm
That is the way that I've done it. Sorry, I did a poor job putting together my example. I've probably had more trouble with section names then anything else in eZ publish.. Sometimes I name a section and my application won't work, but if I remove the name it works! Is there a trick to using section names? Are the names variables that have to be initialized first using let or default?
Tuesday 08 July 2003 4:11:53 pm
Hi Lance
The name parameter on sections is used to set a variable scope. Using sections to loop sets the variables $item, $index and $key in the current scope.
If you try to do what you you are doing with out the names then the outter section loop $item, $index and $key variables with be over written by the inner section loop variables.
If you are still haveing trouble with the template code turn on debugging. I'm sure the answers will be there :)