DOCS: Update to Tutorial 2

Was missing allowed_actions as per 3.1 requirement.
Thanks to Stefanovic72 for posting on the forum :)
This commit is contained in:
camfindlay 2013-11-30 10:23:33 +13:00 committed by Ingo Schommer
parent 46d662fe31
commit fd41112d15

View File

@ -385,10 +385,15 @@ The controller for a page is only created when page is actually visited, while t
## Creating a RSS feed
An RSS feed is something that no news section should be without. SilverStripe makes it easy to create RSS feeds by providing an `[api:RSSFeed]` class to do all the hard work for us. Create the following function in the
*ArticleHolder_Controller*:
An RSS feed is something that no news section should be without. SilverStripe makes it easy to create RSS feeds by providing an `[api:RSSFeed]` class to do all the hard work for us. Add the following in the *ArticleHolder_Controller* class:
**mysite/code/ArticlePage.php**
:::php
private static $allowed_actions = array(
'rss'
);
public function rss() {
$rss = new RSSFeed($this->Children(), $this->Link(), "The coolest news around");
return $rss->outputToBrowser();
@ -403,6 +408,8 @@ Depending on your browser, you should see something like the picture below. If y
Now all we need is to let the user know that our RSS feed exists. Add this function to *ArticleHolder_Controller*:
**mysite/code/ArticlePage.php**
:::php
public function init() {
RSSFeed::linkToFeed($this->Link() . "rss");