Re: Help with Displaying RSS feed links

From: Date: Tue, 09 Sep 2003 20:43:41 +0000
Subject: Re: Help with Displaying RSS feed links
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-162108@lists.php.net to get a copy of this message
On Tue, 9 Sep 2003 15:35:48 -0500 "Frank Miller" <fmiller@tamut.edu> wrote: > Hello all, > > I'm working on an entry page where I would like to show some of the > current headlines from technology websites. I've been following and > pretty much understand the article on devshed > http://www.devshed.com/Server_Side/PHP/PHPRDF/page1.html > Plugging RDF > content into your Website. From what I gather from the article is that > he uses a foreach loop to display the Title, link and description > which could be anywhere from 5 to 15 links. I only have room on my > page for 3 and then I plan on putting a more link taking visitors to a > page where I'll have more room. > Can anyone point me in the right direction? Right now I don't get an > error but I also don't get any text or results. <?php // http://pear.php.net/manual/en/package.xml.xml-rss.example.php require_once "XML/RSS.php"; $rss =& new XML_RSS("http://slashdot.org/slashdot.rdf"); $rss->parse(); echo "<h1>Headlines from <a href=\"http://slashdot.org\">Slashdot</a></h1>\n"; echo "<ul>\n"; >$i = 0; foreach ($rss->getItems() as $item) { > if ($i == 3) > break; echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] . "</a></li>\n"; $i++; } echo "</ul>\n"; ?> Done.

« previous php.general (#162108) next »