Jump to:

23456 Posts in 18905 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » RSS and silverstripe 3.1

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

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

Page: 1
Go to End
Author Topic: 470 Views
  • nmshah
    Avatar
    Community Member
    21 Posts

    RSS and silverstripe 3.1 Link to this post

    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

  • Nobrainer Web
    Avatar
    Community Member
    134 Posts

    Re: RSS and silverstripe 3.1 Link to this post

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

  • nmshah
    Avatar
    Community Member
    21 Posts

    Re: RSS and silverstripe 3.1 Link to this post

    Thank you. This works perfectly.

    470 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.