Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
421 views
in Q2A Core by

i'm using a code to show my top 5 recent question using rss feed but it's not working.can you check this or tell something else...........

<?php

$rss = new DOMDocument();
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array ( 
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
 
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
 
);
array_push($feed, $item);
}
$limit = 5;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' &amp; ', $feed[$x]['title']);
$link = $feed[$x]['link'];
 
 
echo '<p><strong><a href="'.$link.'" title="'.$title.'">'.$title.'</a></strong><br />';
 
}
?>
 
by
You should not start another question for the same purpose...

1 Answer

0 votes
by
edited by

Its displaying everything I have tested on my dev environment.

 

Also showing this site ( Question2Answer ) rss feed also.. see image below

I am using the same code what you following from the tutorial.. just compar with this code http://pastebin.com/DKQpMSUF

 

EDIT:

I have checked your code and that is working too.. See image what I got from your code

...