Jump to content

arrays within arrays within arrays ?


altergothen

Recommended Posts

I want to be able to echo array items within an array within an array
Here 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
        )

)
Link to comment
Share on other sites

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!
Link to comment
Share on other sites

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> ";
?>   
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.