Re: [SMARTY] accessing arrays within arrays
| From: | messju mohr | Date: | Wed, 26 May 2004 13:53:17 +0000 |
| Subject: | Re: [SMARTY] accessing arrays within arrays | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-11411@lists.php.net to get a copy of this message | ||
On Wed, May 26, 2004 at 03:18:44PM +0200, Sims, Benjamin wrote:
> I'm having problems accessing an associative array within another array
> which is part of an object. I think code is clearer here:
>
> {section name=records loop=$search->records}
>
> {* The following works, if the query generating $search->records is an
> indexed array *}
> {$search->records[records][0]}
>
> {* However, the following returns an 'undefined index' error when the query
> returns an associative array *}
> {$search->records[records][name]}
the syntax to access a hash-array-element would be:
{$search->records[records].name}
> {/section}
>
> $search is an object; records is an array containing result rows, each of
> which is an array.
>
> I'm not sure if I'm making a syntax mistake, or trying to do something which
> isn't possible - any help much appreciated!
>
> Thanks,
> Benjamin
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php