Accessing individual array members
| From: | Jon Bertsch | Date: | Tue, 16 Jul 2002 16:37:52 +0000 |
| Subject: | Accessing individual array members | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5342@lists.php.net to get a copy of this message | ||
Hi,
I've been bouncing back and forth between foreach and section loops attempting to access individual members of an array of arrays.
My array has a number of associated arrays within it. I can print out the individual arrays OK, but I cannot figure out how to access the individual items within each associative array for formatting purposes.
If my input array is $main_array this code successfully prints out each array, line by line:
{section name=outer loop=$main_array}
{section name=my_info loop=$main_array[outer]}
{$main_array[outer][my_info]}
{/section}
<br>
{/section}
BUT I cannot get at the items within the array.
I've tried identifying the field names from the database to no avail, e.g.:
{$main_array[outer][my_info].field_name}
{$main_array[outer][my_info][field_name]}
I must be missing something simple here. Any help would be greatly appreciated.
Thanks
Jon Bertsch