altergothen Posted October 20, 2006 Share Posted October 20, 2006 I want to be able to echo array items within an array within an arrayHere is my array structure:Please help!Thanks.Array( [inside_image] => [items] => Array ( [0] => Array ( [title] => Bangladesh's Health Nutrition Program Gets 460 Mln USD (RedNova) [link] => http://us.rd.yahoo.com/dailynews/rss/search/health+nutrition. [description] => 10/19/2006 - European food companies are already being asked to ... ) [1] => Array ( [title] => Member States start compiling health claims lists (Nutraingredients.com) [link] => http://us.rd.yahoo.com/dailynews/rss/search/health+nutrition/SIG=12o66dneo [description] => 10/19/2006 - European food companies are already being asked to ... ) [2] => Array ( [title] => Good nutrition essential for bone health (Antara News) [link] => http://us.rd.yahoo.com/dailynews/rss/search/health+nutrition/SIG=11f9hhq9g [description] => (Full text of a statement. Contact details below.) )) [channel] => Array ( [title] => Yahoo! News Search Results for health nutrition )) Quote Link to comment Share on other sites More sharing options...
printf Posted October 20, 2006 Share Posted October 20, 2006 The easy part is walking the array, the hard part is knowing the format you need the results returned in! Left me explain that. The only time you really need to walk through an array is when you need to do something to the complete array, like remove slashes or set some elements that may have a certain value or maybe empty. In this case it's different, because you need to format the output as your running through the array. To do that, one needs to know how you want to format the output.me! Quote Link to comment Share on other sites More sharing options...
Ferenc Posted October 20, 2006 Share Posted October 20, 2006 <?php echo $array_name['items']['0']['title'];echo $array_name['items']['0']['link'];echo $array_name['items']['0']['description'];?>If you need to show each item you will needd to create a loop of some sort Quote Link to comment Share on other sites More sharing options...
altergothen Posted October 20, 2006 Author Share Posted October 20, 2006 Thanks a million Guys!printf - please can you give me a formatted example?thanks Quote Link to comment Share on other sites More sharing options...
altergothen Posted October 20, 2006 Author Share Posted October 20, 2006 I think i figured it out? ..... Correct?>>>$title = $rss_array['items']['0']['title'];$link = $rss_array['items']['0']['link'];$description = $rss_array['items']['0']['description'];echo "<p class='heading'><a href='$link'>$title</a></p><p class='text'>$description</p><a href='$link'>Read Full Article ...</a> ";?> Quote Link to comment Share on other sites More sharing options...
Orio Posted October 20, 2006 Share Posted October 20, 2006 Yeah :)Orio. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.