Referencing complex associative array

From: Date: Thu, 28 Apr 2005 00:37:36 +0000
Subject: Referencing complex associative array
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12545@lists.php.net to get a copy of this message
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. If I do a var_dump on $result, it looks like this: array(10) { ["TITLE"]=> string(39) "BBC News | News Front Page | UK Edition" ["LINK"]=> string(47) "http://news.bbc.co.uk/go/rss/-/1/hi/default.stm" ["DESCRIPTION"]=> string(33) "Updated every minute of every day" ["LANGUAGE"]=> string(5) "en-gb" ["LASTBUILDDATE"]=> string(27) "Wed, 27 Apr 05 23:59:27 GMT" ["COPYRIGHT"]=> string(92) "Copyright: (C) British Broadcasting Corporation, http://news.bbc.co.uk/1/hi/help/3281849.stm" ["DOCS"]=> string(33) "http://www.bbc.co.uk/syndication/" ["TTL"]=> string(2) "15" ["IMAGE"]=> array(3) { ["TITLE"]=> string(8) "BBC News" ["URL"]=> string(56) "http://news.bbc.co.uk/nol/shared/img/bbc_news_120x60.gif" ["LINK"]=> string(21) "http://news.bbc.co.uk" } ["ITEMS"]=> array(5) { [0]=> array(5) { ["TITLE"]=> string(31) "Early Iraq legal opinion leaked" ["DESCRIPTION"]=> string(115) "The attorney general doubted the Iraq war would be legal without a new resolution from the UN, leaked advice shows." ["LINK"]=> string(79) "http://news.bbc.co.uk/go/rss/-/1/hi/uk_politics/vote_2005/frontpage/4491105.stm" ["GUID"]=> string(70) "http://news.bbc.co.uk/1/hi/uk_politics/vote_2005/frontpage/4491105.stm" ["PUBDATE"]=> string(27) "Wed, 27 Apr 05 22:32:09 GMT" } [1]=> array(5) { ["TITLE"]=> string(32) "Man arrested over Abigail attack" ["DESCRIPTION"]=> string(96) "A 25-year-old man has been arrested by detectives hunting the man who stabbed Abigail Witchalls." ["LINK"]=> string(73) "http://news.bbc.co.uk/go/rss/-/1/hi/england/southern_counties/4492119.stm" ["GUID"]=> string(64) "http://news.bbc.co.uk/1/hi/england/southern_counties/4492119.stm" ["PUBDATE"]=> string(27) "Wed, 27 Apr 05 23:53:19 GMT" } [2]=> array(5) { ["TITLE"]=> string(32) "Jackson's ex-wife in witness box" ["DESCRIPTION"]=> string(122) "Prosecutors in Michael Jackson's child abuse trial begin questioning the star's ex-wife and mother of two of his children." ["LINK"]=> string(67) "http://news.bbc.co.uk/go/rss/-/1/hi/entertainment/music/4490259.stm" ["GUID"]=> string(58) "http://news.bbc.co.uk/1/hi/entertainment/music/4490259.stm" ["PUBDATE"]=> string(27) "Wed, 27 Apr 05 21:58:53 GMT" } [3]=> array(5) { ["TITLE"]=> string(33) "US terror charge Briton convicted" ["DESCRIPTION"]=> string(112) "A British man is found guilty of attempting to support terrorism after trying to sell a missile to an FBI agent." ["LINK"]=> string(50) "http://news.bbc.co.uk/go/rss/-/1/hi/uk/4491181.stm" ["GUID"]=> string(41) "http://news.bbc.co.uk/1/hi/uk/4491181.stm" ["PUBDATE"]=> string(27) "Wed, 27 Apr 05 20:07:48 GMT" } [4]=> array(5) { ["TITLE"]=> string(28) "Airbus A380 completes flight" ["DESCRIPTION"]=> string(103) "The world's largest passenger plane, the Airbus A380, lands safely, having completed its maiden flight." ["LINK"]=> string(56) "http://news.bbc.co.uk/go/rss/-/1/hi/business/4488361.stm" ["GUID"]=> string(47) "http://news.bbc.co.uk/1/hi/business/4488361.stm" ["PUBDATE"]=> string(27) "Wed, 27 Apr 05 17:32:10 GMT" } } } -- Roger --------------------------------------------------- Sign Up for free Email at http://ureg.home.net.my/ ---------------------------------------------------

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