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.

Blog Module /

Discuss the Blog Module.

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

RSS feed for blog entries with a certain tag


Go to End


5 Posts   1999 Views

Avatar
baba-papa

Community Member, 279 Posts

23 August 2009 at 10:34pm

I want to provide my blog with an rss feed for tags. I tried for 2 hours without any result. I woud appreciate any help.

Avatar
baba-papa

Community Member, 279 Posts

23 August 2009 at 11:46pm

After three hours of trial and error I found a solution. All changes are done in BlogHolder.php
In the init() I chnged the link:

RSSFeed::linkToFeed($this->Link(). "rss/" .$this->ShowTag(), _t('BlogHolder.RSSFEED',"RSS feed of this blog"));

In the rss() I added a parameter to $entries:
$entries = $this->Entries(20, Director::urlParam('ID'));

The rss widget still works the same way. The browsers rss link in the address line is now dynamic and shows entries by the selected tag.
Now I just need a template link to rss.

Avatar
baba-papa

Community Member, 279 Posts

24 August 2009 at 12:56am

Here is the template link to RSS:

function LinkToTagRSS() {
            $url=$this->Link(). "rss/" .$this->ShowTag();
            return $url;
}

Very simple ;) I hope I did not break a big security hole in my installation.

Avatar
Juanitou

Community Member, 323 Posts

24 August 2009 at 11:11pm

Hi!

That's a nice addition (BTW, did you submit it to Trac?), thank you!

Nevertheless, $LinkToTagRSS does not work in templates of widgets included in the Sidebar (i.e. SubscribeRSSWidget.ss and TagCloudWidget.ss). I don't know if it is a bug or a feature… ;)

Best regards,
Juan

Avatar
baba-papa

Community Member, 279 Posts

26 August 2009 at 5:11am

Hi Juanitou,

I didn´t submit it to trac yet, mabe I finde some time tomorrow.
I´m not familiar with the widget arcitecture, but I know that those widget have their own controllers (eg RSSWidget.php). Maybe you have to implement the LinkToTagRSS-method there to call it on a widget template.

Greetings,

Roland