mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
46d662fe31
commit
fd41112d15
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user