pb to get the key of an hash table

Author Message

François Xavier Lacroix

Friday 24 June 2005 7:41:14 am

Hello,

I m looking for something to get the key of a hash.
I got a hash like ("01/01/2005" => "myValue"..), and when i do my section, i would like to find out my date and my value.

I have tried : http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/array_handling
and some other links without success.

Any idea ?
fx

Paul Borgermans

Friday 24 June 2005 9:20:34 am

Hi F-X

Try this:

{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}
<p> Hash array looping with a name (depreciated)</p>
{section name=element loop=$hasharray}
key: <b>{$element:key}</b> value: <b>{$element:item}</b><br />
{/section}

{/let}

Have a nice weekend

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

François Xavier Lacroix

Monday 27 June 2005 2:28:44 am

so great, my best thanks !

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 07:14:11
Script start
Timing: Jan 19 2025 07:14:11
Module start 'layout'
Timing: Jan 19 2025 07:14:11
Module start 'content'
Timing: Jan 19 2025 07:14:11
Module end 'content'
Timing: Jan 19 2025 07:14:11
Script end

Main resources:

Total runtime0.7320 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 590.2891152.6250
Module start 'layout' 0.00490.0034 742.914139.4453
Module start 'content' 0.00830.7221 782.3594543.7969
Module end 'content' 0.73040.0016 1,326.156312.1563
Script end 0.7320  1,338.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4297160.0002
Check MTime0.00130.1718160.0001
Mysql Total
Database connection0.00070.096310.0007
Mysqli_queries0.678892.7355570.0119
Looping result0.00060.0800550.0000
Template Total0.693594.720.3467
Template load0.00180.249520.0009
Template processing0.691694.482720.3458
Template load and register function0.00010.012310.0001
states
state_id_array0.00340.468810.0034
state_identifier_array0.00170.237320.0009
Override
Cache load0.00150.2059210.0001
Sytem overhead
Fetch class attribute can translate value0.00080.112620.0004
Fetch class attribute name0.00150.210350.0003
XML
Image XML parsing0.00120.162820.0006
class_abstraction
Instantiating content class attribute0.00000.001560.0000
General
dbfile0.00110.1461230.0000
String conversion0.00000.001440.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
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/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: 19
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs