Skip to content

Instantly share code, notes, and snippets.

@thezenmonkey
Created December 5, 2013 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thezenmonkey/7808390 to your computer and use it in GitHub Desktop.
Save thezenmonkey/7808390 to your computer and use it in GitHub Desktop.
Quick function to add tag specific RSS feed to SilverStripe Blog. You can add this to DataExtension to BlogTree_Controller
function tag() {
if ($this->owner->request->param('Action') == 'tag' && $this->owner->request->param('OtherID') == "rss") {
$entries = $this->owner->Entries(20, Convert::raw2xml($this->owner->request->latestParam('ID')));
if($entries) {
$rss = new RSSFeed($entries, $this->owner->Link('rss'), ($blogName ? $blogName : $altBlogName), "", "Title", "RSSContent");
return $rss->outputToBrowser();
}
} else {
return $this->owner;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment