Jump to content


Photo

"foreach" problem


  • Please log in to reply
No replies to this topic

#1 casper_1707

casper_1707
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 17 April 2006 - 06:21 PM

Hi!

I want to get news from a RSS. I get the news and i try to display them everyone in his own table.
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>";
      }
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:
<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>
 
<BR><BR>
 
<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>
The example is much longer but i posted just a fragment.
How i extract the text between tags?

Thanks!

PS: Sorry for my english.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users