Forums / General / pb to get the key of an hash table
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
Monday 27 June 2005 2:28:44 am
so great, my best thanks !