On Tue, 9 Sep 2003 15:35:48 -0500
"Frank Miller" <[EMAIL PROTECTED]> 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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to