I have literally done just this for a clients site. What I did was add the ability to add up to 3 feeds into a field in the CMS, like this:
public static $db = array(
'Feed1Name' => 'Text',
'Feed1URL' => 'Text',
'Feed2Name' => 'Text',
'Feed2URL' => 'Text',
'Feed3Name' => 'Text',
'Feed3URL' => 'Text'
);
Then amended the Method to allow you to load in theses feeds from your template, this is a bit tricky because silverstripes template language doesn't allow you to load variables into methods, so instead I created an array to store the feeds within the method, and instead access them via a number.
So something like this:
public function getItemsFromRSS($feedNum = 0) {
include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php'));
$feedItem = array();
array_push($feedItem,$feedsPage->Feed1URL);
array_push($feedItem,$feedsPage->Feed2URL);
array_push($feedItem,$feedsPage->Feed3URL);
$output = new DataObjectSet();
$feed = new SimplePie($feedItem[$feedNum], TEMP_FOLDER);
$feed->init();
if($items = $feed->get_items(0, $feedItems)) {
foreach($items as $item) {
// Cast the Title
$title = new Text('Title');
$title->setValue($item->get_title());
$output->push(new ArrayData(array(
'Title' => $title,
'Link' => $item->get_link()
)));
}
return $output;
}
}
Finally, in your template, call this using something like:
<div class="NewsFeed">
<h2>
$Feed1Name
</h2>
<ul>
<% control getItemsFromRSS(1) %>
<li>$Title <a href="$Link" target="_blank">read more</a></li>
<% end_control %>
</ul>
</div>
Its not the best approach, if you add more than 3 feeds to the CMS, you need to add additional array_push($feedItem,$feedsPage->Feed3URL); to your method to account.
An alternative would be to use a dataobject, but I havent really had time for that :)
Mo