piixeldesigns
asked on
Display only the latest result from the rss
Hey All,
I have a rss feed which is currently showing 20+ summaries and I only want to show the latest summary (so only ever 1 article).
Here is the code which I am using:
Any ideas on this would be great!
Thanks in advance,
PD!!!
I have a rss feed which is currently showing 20+ summaries and I only want to show the latest summary (so only ever 1 article).
Here is the code which I am using:
$nid = "foxmain";
$need_url="http://feeds.news.com.au/public/rss/2.0/fs_breaking_news_13.xml";
$provider = "Fox Sports";
$i=0;
$doc = new DOMDocument();
$doc->load($need_url);
$employees = $doc->getElementsByTagName("item");
foreach( $employees as $employee ) {
$i++;
$names = $employee->getElementsByTagName("title");
$name = $names->item(0)->nodeValue;
$links= $employee->getElementsByTagName("link");
$link= $links->item(0)->nodeValue;
$descriptions= $employee->getElementsByTagName("description");
$description= $descriptions->item(0)->nodeValue;
echo " <h4>$name</h4>";
echo "<p>$description</p>";
echo " <p><a href=$link target='_blank'><strong>» More</strong></a> ";
if($getUserData > 0) {
echo " <a href='public_create_forum.php?an=".$name."&ad=".$description."'><strong>» Comment</strong></a></p>";
} else {
echo " <a id='view_comment_".$i."' href='#' onclick='getforumdata(".$i.");'><strong>» Comment</strong></a></p>";
}
}
Any ideas on this would be great!
Thanks in advance,
PD!!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.