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.

eZ debug

Timing: Jan 19 2025 06:25:57
Script start
Timing: Jan 19 2025 06:25:57
Module start 'layout'
Timing: Jan 19 2025 06:25:57
Module start 'content'
Timing: Jan 19 2025 06:25:58
Module end 'content'
Timing: Jan 19 2025 06:25:58
Script end

Main resources:

Total runtime0.6422 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.0062 589.0547152.6094
Module start 'layout' 0.00620.0032 741.664139.4141
Module start 'content' 0.00950.6311 781.0781527.1797
Module end 'content' 0.64050.0017 1,308.25788.1875
Script end 0.6422  1,316.4453 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00360.5596160.0002
Check MTime0.00140.2180160.0001
Mysql Total
Database connection0.00110.169210.0011
Mysqli_queries0.593692.4190540.0110
Looping result0.00050.0735520.0000
Template Total0.610095.020.3050
Template load0.00210.326020.0010
Template processing0.607894.643320.3039
Template load and register function0.00020.031510.0002
states
state_id_array0.00090.144210.0009
state_identifier_array0.00070.114620.0004
Override
Cache load0.00170.2675230.0001
Sytem overhead
Fetch class attribute can translate value0.00090.137720.0004
Fetch class attribute name0.00140.225130.0005
XML
Image XML parsing0.00070.109020.0003
class_abstraction
Instantiating content class attribute0.00000.001130.0000
General
dbfile0.00090.1410160.0001
String conversion0.00000.001640.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
5content/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/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.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: 14
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs