[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    Re: [SMARTY] accessing arrays within arrays
From:       messju mohr <messju () lammfellpuschen ! de>
Date:       2004-05-26 13:53:17
Message-ID: 20040526135317.GK3913 () pharao ! serveftp ! org
[Download RAW message or body]

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

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic