Forums / Setup & design / Accessing a particular var in loop
Jacob C
Tuesday 22 March 2005 5:02:40 pm
Hi,
Coming from a PHP background (new to Exponential), I don't understand why this doesn't work:
{section var=size loop=$node.object.data_map.size.content} {$node.object.data_map.size.class_content.options.[$size].name} {/section}
I tried the following as well (didn't work):
{section var=size loop=$node.object.data_map.size.content} {let current=$node.object.data_map.size.class_content.options.[$size]} {$current.name} {/section}
I am attempting to access the name for the current option ([$size]) applied to the item. However, the following does properly printout the name I am trying to access dynamically in the above loop.
{$node.object.data_map.size.class_content.options.0.name}
Can someone clarify why this doesn't work for me?
Thanks!
Łukasz Serwatka
Tuesday 22 March 2005 11:02:32 pm
Have you tried this? What data type is $node.object.data_map.size.content?
{section loop=$node.object.data_map.size.content} {$node.object.data_map.size.class_content.options.[$item].name} {/section}
You can use "attribute" to displays all attributes of $size variable
{section var=size loop=$node.object.data_map.size.content} {$size|attribute} {/section}
Personal website -> http://serwatka.net Blog (about eZ Publish) -> http://serwatka.net/blog
Wednesday 23 March 2005 9:57:14 am
Hi Lukasz,
What you posted has worked. It is a 'Selection' datatype. Thanks for the response and I'm sure I'll be posting another question again soon ;-)
Jacob
Wednesday 23 March 2005 1:59:14 pm
Hi Jacob,
My pleasure!
If you find person with similar problem just pass the tip ;-)