Re: [SMARTY] Referencing complex associative array

From: Date: Thu, 28 Apr 2005 16:29:28 +0000
Subject: Re: [SMARTY] Referencing complex associative array
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12547@lists.php.net to get a copy of this message
Roger Thomas wrote:
Hi, I parsed an XML file and pushed the results into an array. My question is, when I assign this array, $result, to Smarty, how do I reference it ? I have something like: {section name=feed loop=$news} <tr>
    <td>
      {$news[feed].COPYRIGHT}
    </td>
</tr> {/section} How do I reference, say, the LINK under ITEMS ? Please advise.
should be {$result.ITEMS[0].LINK}. you can {section} through the ITEMS. however, if you know you're going to access specific options like this, I'd recommend restructuring $result in the PHP side (i.e. split it up into smaller chunks). If you're just parsing RSS feeds, perhaps you might want to check out PEAR::XML_RSS. cheers martin -- 127.0.0.1 sweet 127.0.0.1 Please use my public PGP key: http://www.mbant.de/mbant-gpg-key

« previous php.smarty.general (#12547) next »