You are here: Re: [SMARTY] Referencing complex associative array « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Referencing complex associative array

Posted by Martin Braun on 04/28/05 19:29

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация