Jump to content


This topic is now archived and is closed to further replies.


"foreach" problem

Recommended Posts


I want to get news from a RSS. I get the news and i try to display them everyone in his own table.
[code]foreach ($rss->item as $item)
echo "<table><tr><td><a href=$item->link>$item->title</a></td></tr>";
      echo "<tr><td>$item->description</td></tr></table>";
      }[/code] I don't know why, but insteed dispaying for every news a table, i get a table witch includes all the news.

My second problem is when i try to get the entire content of the news (wich results on the following of the link).
Let's say i have the following:
[code] <span class=arttitle>Romania sub ape,  episodul 2006</span><br /><span class=artdatetime>14 Aprilie 2006</span><br /><span class=arteditorname>Nicoleta Chiru, Miruna Olteanu</span>


<span class=artdescription>La un an de la inundatiile devastatoare, banatenii se lupta iarasi cu revarsarile raurilor.<br /></span></p><BR>
                                            <p><span class=artbody><p>Cele mai multe rauri din tara au depasit cel putin cotele de atentie, hidrologii avertizand ca zona Banatului este in continuare/span>[/code] The example is much longer but i posted just a fragment.
How i extract the text between tags?


PS: Sorry for my english.

Share this post

Link to post
Share on other sites


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.