I did try to use Willr answer to topic Simple Pie with Silverstripe, however I don't know how to get the RSS Feeds in my template.
I did following: mysite/code/RSSPage.php (Note: I did experiment also with the latest SimplePie - same result hovewer on simplepie.inc)
<?php
class RSSPage extends Page {
static $description= "Pagina feed RSS";
}
class RSSPage_Controller extends Page_Controller {
function My_Feeds($url) {
// require_once("../framework/thirdparty/simplepie/simplepie.inc");
require_once("../framework/thirdparty/simplepie2/autoloader.php");
$this->feed = new SimplePie($url, "../silverstripe-cache/");
$this->feed->init();
$this->feed->handle_content_type();
$items = new DataObjectSet();
if($this->feed->get_items()) {
foreach ($this->feed->get_items() as $item) {
$items->push(new ArrayData($item));
}
}
return $items;
}
}
This does not display the feed:
excerpt from templates/RSSPage.ss
<ul>
<% loop My_Feeds %>
<li>$My_Feeds - $Title</li>
<% end_loop %>
</ul>
My question: how can I access the DataObjectSet from a .ss file?