Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

External RSS


6 Posts   1924 Views


28 September 2009 at 1:29pm Community Member, 509 Posts

Hi All,

Quick question, I want to add the most recent news story from a third party RSS feed to one of my templates. I am quite happpy to do this via SimpleXML, but I was wondering if SS has something builtin that might be more preferable to use?




28 September 2009 at 1:55pm Community Member, 190 Posts

I just grabbed code from the Blog module (RSSWidget.php).

Attached Files

28 September 2009 at 6:30pm (Last edited: 28 September 2009 6:31pm), Community Member, 901 Posts

Refactoring RSSWidget.php is probably a good solution. If you need more functionality, I'd probably use SimplePie ( instead of parsing RAW XML using SimpleXML. It's a pretty neat php class for all your RSS/Atom Feed needs ;)


30 September 2009 at 10:27am Community Member, 509 Posts

Quick question. Has anyone tried to pull in the Silverstripe blog (

I have tried several different methods, they all result in a file not found error, or something similar?

Anyone know why?


30 September 2009 at 3:38pm Forum Moderator, 5511 Posts

How are you doing it?

We pull the blog feed fine from


1 October 2009 at 3:51am Community Member, 509 Posts

I got it working now, using recycled code from the blog module, as mentioned above:

function LatestSSNews() {
      $output = new DataObjectSet();
      include_once(Director::getAbsFile(SAPPHIRE_DIR . '/thirdparty/simplepie/SimplePie.php'));
      $t1 = microtime(true);
      $feed = new SimplePie('', TEMP_FOLDER);
      if($items = $feed->get_items(0, 2)) {
         foreach($items as $item) {
            // Cast the Date
            $date = new Date('Date');

            // Cast the Title
            $title = new Text('Title');
            // Cast the description and strip
            $desc = new Text('Description');

            $output->push(new ArrayData(array(
               'Title'         => $title,
               'Date'         => $date,
               'Link'         => $item->get_link(),
               'Description'   => $desc
         return $output;

This works ok, I think the way I was trying to do it before was incorrect, I was trying to load it in using the RestfulService class, which didn't seem to work :s.