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'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.

General Questions /

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

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

RSS and silverstripe 3.1


Go to End


3 Posts   1608 Views

Avatar
nmshah

Community Member, 21 Posts

3 July 2013 at 4:45am

Edited: 03/07/2013 5:01am

I have a code that was working in silverstripe 3.0 to show rss. But the same doesn't work on silverstripe 3.1

The code was put in mysite/code/page.php, which is as follows

<?php
class Page extends SiteTree {
	private static $db = array(
	);
	private static $has_one = array(
	);
}

class Page_Controller extends ContentController {
	private static $allowed_actions = array (
	);
	public function init() {    
		RSSFeed::linkToFeed($this->Link() . "rss");
		parent::init();
	}
	public function rss() {
		$rss = new RSSFeed($this->LatestUpdates(), $this->Link(), "10 Most Recently Updated Pages", "Shows a list of the 10 most recently updated pages.");
		return $rss->outputToBrowser();
	}
	public function LatestUpdates() {
		return Page::get()->sort("LastEdited", "DESC")->limit(10);
	}
}

I was able to access the rss by using the following url

http://my-web-site-add/home/rss

The error that I get on silverstripe 3.1 when following the same process

Action 'rss' isn't allowed on class HomePage_Controller.

Do I need to change something to make this work in silverstripe 3.1

Avatar
Nobrainer Web

Community Member, 138 Posts

3 July 2013 at 7:44am

I Think you just need to add rss to static allowed actions
private static $allowed_actions = array (
'rss'
);

Avatar
nmshah

Community Member, 21 Posts

4 July 2013 at 5:03pm

Thank you. This works perfectly.