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:

Archive /

Our old forums are still available as a read-only archive.

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

RSS feed as blog posts

Go to End

3 Posts   1532 Views


Community Member, 23 Posts

1 October 2008 at 9:01pm

I know there is a widget that posts RSS results in a side menu, so SilverStripe is clearly able to handle them, what I want however is for the RSS results to show up as a new blog post. is that possible?
And could anyone give me some pointers on how it's done?


Forum Moderator, 5523 Posts

2 October 2008 at 1:17pm

I assume that the RSS feed comes from an external source and you want to create posts with them.. I did the same with my twitter feed. Got the feed data, and made objects from them so that I could sort / search all of them. Heres an outline of my code. You will need to put this somewhere eg Page.php -> Page_Controller

	$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;

Thats the outline at least. This will do things like create the blog entry every time you look at the feed url (which is probably not wise) but thats how it would work


Community Member, 23 Posts

2 October 2008 at 7:23pm

Thanks for your help willr, at least now I have something to work with :)