Forums / Developer / how i display a bi-dimensional array?

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