Forums / Setup & design / Accessing a particular var in loop

Accessing a particular var in loop

Author Message

Jacob C

Tuesday 22 March 2005 5:02:40 pm

Hi,

Coming from a PHP background (new to ezPublish), 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

Hi,

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

Jacob C

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

Łukasz Serwatka

Wednesday 23 March 2005 1:59:14 pm

Hi Jacob,

My pleasure!

If you find person with similar problem just pass the tip ;-)

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog