Re: [SMARTY] Referencing complex associative array
| From: | Robert Amos | Date: | Tue, 03 May 2005 09:52:39 +0000 |
| Subject: | Re: [SMARTY] Referencing complex associative array | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12576@lists.php.net to get a copy of this message | ||
On 4/29/05, Maximillian Schwanekamp <lists@neptunewebworks.com> wrote:
> Abdul-Wahid Paterson wrote:
> For complex array structures I find it easier to read/write the template
> markup by using assign() here, especially if you're going to use
> multiple values from the array:
>
> <ul>
> {section name=news value=$result.ITEMS}
> {assign value=$result.ITEMS[news] var="item"}
> <li>
> <h3><a href="{$item.LINK}">{$item.TITLE}</a></h3>
> <p>{$item.DESCRIPTION}</p>
> </li>
> {/section}
> </ul>
Which is exactly what {foreach} does automatically, only with PHP5 and
newer, its alot more efficient..
-bok
--
Xnyo - http://xnyo.odynia.org/