hash :key not available with foreach

Author Message

Bernhard Reiter

Wednesday 06 July 2005 2:21:22 am

This code works great with old template syntax.
But it seems like the key is no longer available when using foreach

{let hasharray=hash('key1','value1','key2','value2')}
<p> Hash array looping with a var:</p>
{section var=element loop=$hasharray}
key: <b>{$element.key}</b> value: <b>{$element}</b><br />
{/section}

Mikhail Chekanov

Wednesday 10 August 2005 4:11:15 am

Yes, it's not available. Keep it simple:

{foreach $hasharray as $key => $value}
key: {$key}, value: {$value}
{/foreach}

--
mike
#6595551

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 18 2025 16:13:21
Script start
Timing: Jan 18 2025 16:13:21
Module start 'layout'
Timing: Jan 18 2025 16:13:21
Module start 'content'
Timing: Jan 18 2025 16:13:22
Module end 'content'
Timing: Jan 18 2025 16:13:22
Script end

Main resources:

Total runtime1.1630 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 590.8828152.6250
Module start 'layout' 0.00530.0034 743.507839.4453
Module start 'content' 0.00871.1527 782.9531485.6641
Module end 'content' 1.16130.0016 1,268.61728.3125
Script end 1.1630  1,276.9297 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2838160.0002
Check MTime0.00140.1179160.0001
Mysql Total
Database connection0.00080.065710.0008
Mysqli_queries1.125296.7505540.0208
Looping result0.00050.0426520.0000
Template Total1.132097.320.5660
Template load0.00190.165120.0010
Template processing1.130097.164120.5650
Template load and register function0.00020.014610.0002
states
state_id_array0.00100.090110.0010
state_identifier_array0.00150.124820.0007
Override
Cache load0.00150.133090.0002
Sytem overhead
Fetch class attribute can translate value0.00100.082320.0005
Fetch class attribute name0.00120.101420.0006
XML
Image XML parsing0.00020.015420.0001
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00150.1303100.0002
String conversion0.00000.000540.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
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 9
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs