Associative Array

Author Message

Softriva .com

Monday 19 February 2007 11:25:59 pm

May be this is an easy question!!!

How can I create an associative array that looks like

Key Value
----- --------
A XYZ
B MSS
C SSS

without the index i.e. not like

Index Key Value
-------- ------ --------
0 A XYZ
1 B MSS
2 C SSS

I wont use the arraysortoperator wrappers. I mean I want to sort the first array above using the key. If sort it using the 2nd array, I won't get the write sort.

Felix Woldt

Tuesday 20 February 2007 12:10:18 am

Hallo,

i think the 'hash' operator is want you want
http://ez.no/doc/ez_publish/technical_manual/3_8/reference/template_operators/arrays/hash

{def $hash = hash('A', 'ValueA', 'B', 'ValueB', 'C', 'ValueC')}

http://www.jac-systeme.de - Developers united in eZ Publish: http://www.cjw-network.com

CJW Newsletter 1.0.0 released: http://projects.ez.no/cjw_newsletter

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.