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?
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
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;
$blog->write();
}
}
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
Thanks for your help willr, at least now I have something to work with :)