05-02-2008, 04:16 AM
|
#1 (permalink)
|
|
The Visitor
Join Date: Apr 2008
Posts: 3
Thanks: 3
|
what a headache
hello... here's the code
what i wanted to know is how do I list only the 5 first items from the xml? the foreach is taking all items from the xml code.
<?php
require_once "XML/RSS.php";
$rss =& new XML_RSS("sample.xml");
$rss->parse();
echo " <ul>\n";
foreach ($rss->getItems() as $item) {
echo "<li><a href=\"" . $item['link'] . "\">" . $item['title'] .
"</a></li>\n";
}
echo "</ul>\n";
?>
|
|
|
|