Hello,
I would like to post the following pubmed RSS feed on my articleholder page:
http://eutils.ncbi.nlm.nih.gov/entrez/eutils/erss.cgi?rss_guid=1JAk5IMbg5brNNHlJdI8W1KPW9SEh2vqRx6_PmPUwADwffFU05
I've looked at a number of posts on the subject and I'm still confused as there are a number of suggested approaches (some likely outdated). What is considered to be the easiest, most up-to-date way to show a rss feed on any given page (SS version 2.3.2+)?
I came across this post: http://www.silverstripe.org/archive/show/218454#post218454 where Willr suggested the following code (which I added to my ArticleHolder.php file):
function CustomRSSFeed() {
$feed = new SimplePie(URL OF THE RSS FEED);
$feed->feed->init();
$output = new DataObjectSet();
if($items = $feed->feed->get_items(0, 10)) {
foreach($items as $item) {
$output->push(new ArrayData(array(
"Title" => $item->get_title(),
"Link" => $item->get_link()
)));
}
}
return $output;
}
Using <% control CustomRSSFeed %>$Title<% end_control %> in ArticleHolder.ss.
However, I get the following error: Fatal error: Class 'SimplePie' not found in /Applications/XAMPP/xamppfiles/htdocs/holybasil/mysite/code/ArticleHolder.php on line 27. I put my url in quotes for $feed, without which there was an additional error.
I tried the restfulservice approach as suggested at the bottom of this link.
http://doc.silverstripe.com/doku.php?id=restfulservice#how_to_use_restfulservice_to_easily_embed_an_rss_feed
But just as "Superautomatic" commented in his post at http://silverstripe.org/archive/show/89336#post89336, I can only get the example RSS feed to work not my own (see above for the RSS address). I suspect that it is RSS 1.0 versus RSS 2.0 issue (my RSS address being 2.0). Jam13 offered some code at the bottom of the Superautomatic posting. However, I have no idea how to implement it in a template. He doesn't give an example.
I would appreciate any help,
Sam