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.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Customising the CMS /

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

RSS feed items to pages

Go to End



Community Member, 70 Posts

9 May 2009 at 4:12am

Edited: 09/05/2009 4:13am


Background: I've seen a few posts around using SimplePie and the RestfulService that show how to present RSS feed items on pages, and have seen WillR's response nearly a year ago for how to insert RSS entries as blog posts (

Situation: I'm trying to grab a news feed and create pages from it (it's a stock news feed, but I'd like to be able to use it with any RSS feed). I have a FeedHolder class that shows a list of FeedEntry items (these are the pages I want to create), and have set it up so they can be manually created in the CMS.

Problem: I understand that I need to first pull in the feed, then insert each feed as a page, but I'm getting a bit confused with his example and can't see how it should be creating entries. Once I get it creating entries, I'd like to call it every so often to update the entries from the feed.

WillR's code from the aforementioned post:

$feed = new RestfulService("URL OF RSS FEED");
   $conn = $feed->connect('');
   $msgs = $feed->getValues($conn, "status");
   $output = new DataObjectSet();
   foreach($msgs as $msg){
     foreach($feed as $feedItem) {
         $blog = new Blog_Entry();
         $blog->Title = "This is the Title"; // should come from $feedItem
         $blog->setDate(date("Y-m-d H:i:s",time()));
         $blog->publish("Stage", "Live");
         $blog->Author = "Author";
         $blog->Content = $feedItem->Content;
         $blog->ParentID = DataObject::get_one('BlogHolder')->ID;

Can anyone point me in the right direction? Or even better show me what needs to be done to get it working?