Multi-dimensional nested arrays in Smarty
| From: | Chad Guilette | Date: | Sat, 27 Oct 2001 11:46:47 +0000 |
| Subject: | Multi-dimensional nested arrays in Smarty | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-72557@lists.php.net to get a copy of this message | ||
I've asked a few questions before on Smarty here and I've worked through them but this one
really has me.
I checked the Smarty lists for answers and couldn't find a clear answer. Here is my problem.
i want to do something to this effect
{section name=loop_index loop=$DATA_ARRAY}
{$DATA_ARRAY[loop_index].somevalue}
{section name=loop_index2 loop=$INNER_ARRAY[loop_index]}
{$INNER_ARRAY[loop_index][loop_index2].SOMEVALUE}
{/section}
{/section}
I basically have an associative array $DATA_ARRAY and I want a second two dimensional array where
the first array index is the subscript of the first so I basically iterate through the second array
within a specific row.
but for the life of me I can't get this properly.
how would I set this up properly during assignment and output?
I believe the above is right for output but what about assignment?
$templ_var->append("INNER_ARRAY", ?????);
I've tried a lot of things but none seem to work...
If anyone of you have any insight it would be greatly appreciated.
chad@guilette.net