how i display a bi-dimensional array?

Author Message

javier sanchez

Sunday 07 March 2004 11:56:06 pm

well im trying to display a 2 dimension array in a tpl, the array comes from a db fetch with its keys (keys are the names of the fields of the table)

my problem is how to display its info using a {setion and loop} as for i know if i want to display an array using sections i have to loop over the array with its key

but what if i want to display both sub arrays of the array at the same time??

im trying a code like this

arr1= array ( "a" => array("1","2","3"), "b"=> array("a","b","c"));

{section name=sec loop=$arr1}
my number is {$sec.item.a} and my letter is {$sec.item.b}
{/section}

but it doesnt work, im also working with nested loops. .but it doesnt get the job done

any suggestiions in the use of loop for bidimensional array with keys.. will be awesome

javier sanchez-galan

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 03:41:17
Script start
Timing: Jan 19 2025 03:41:17
Module start 'layout'
Timing: Jan 19 2025 03:41:17
Module start 'content'
Timing: Jan 19 2025 03:41:17
Module end 'content'
Timing: Jan 19 2025 03:41:17
Script end

Main resources:

Total runtime0.0162 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0060 589.1797152.6250
Module start 'layout' 0.00600.0032 741.804739.4453
Module start 'content' 0.00920.0046 781.250085.2266
Module end 'content' 0.01380.0025 866.476630.3047
Script end 0.0162  896.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002917.9600140.0002
Check MTime0.00117.0264140.0001
Mysql Total
Database connection0.00063.974610.0006
Mysqli_queries0.003219.422830.0011
Looping result0.00000.105610.0000
Template Total0.001912.010.0019
Template load0.00117.033810.0011
Template processing0.00084.923910.0008
Override
Cache load0.00085.089710.0008
General
dbfile0.00042.159780.0000
String conversion0.00000.063140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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