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

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 19 2025 00:58:26
Script start
Timing: Jan 19 2025 00:58:26
Module start 'layout'
Timing: Jan 19 2025 00:58:26
Module start 'content'
Timing: Jan 19 2025 00:58:27
Module end 'content'
Timing: Jan 19 2025 00:58:27
Script end

Main resources:

Total runtime0.8255 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 589.2578152.6250
Module start 'layout' 0.00610.0033 741.882839.4453
Module start 'content' 0.00930.8149 781.3281552.6563
Module end 'content' 0.82420.0013 1,333.984412.1563
Script end 0.8255  1,346.1406 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.3802160.0002
Check MTime0.00130.1599160.0001
Mysql Total
Database connection0.00110.130910.0011
Mysqli_queries0.762292.3235600.0127
Looping result0.00060.0671580.0000
Template Total0.796196.420.3981
Template load0.00190.225620.0009
Template processing0.794296.209120.3971
Template load and register function0.00020.021110.0002
states
state_id_array0.00100.115710.0010
state_identifier_array0.00070.082520.0003
Override
Cache load0.00160.1951280.0001
Sytem overhead
Fetch class attribute can translate value0.00060.078520.0003
Fetch class attribute name0.00110.133050.0002
XML
Image XML parsing0.00080.091620.0004
class_abstraction
Instantiating content class attribute0.00000.001960.0000
General
dbfile0.00170.2037180.0001
String conversion0.00000.001040.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs