Forums / Setup & design / Associative Array

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

eZ debug

Timing: Jan 19 2025 06:08:12
Script start
Timing: Jan 19 2025 06:08:12
Module start 'content'
Timing: Jan 19 2025 06:08:12
Module end 'content'
Timing: Jan 19 2025 06:08:12
Script end

Main resources:

Total runtime0.0195 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0081 588.8516180.8438
Module start 'content' 0.00820.0048 769.695393.9609
Module end 'content' 0.01290.0065 863.656370.7031
Script end 0.0194  934.3594 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002010.2756120.0002
Check MTime0.00105.0279120.0001
Mysql Total
Database connection0.00115.740210.0011
Mysqli_queries0.003015.610240.0008
Looping result0.00000.117320.0000
Template Total0.006231.910.0062
Template load0.00073.510310.0007
Template processing0.005528.364910.0055
Override
Cache load0.00052.526810.0005
General
dbfile0.003317.0947100.0003
String conversion0.00000.035430.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs