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.

Blog Module

Discuss the Blog Module.

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

RSS feed for blog entries with a certain tag


Reply

5 Posts   1308 Views

Avatar
baba-papa

23 August 2009 at 10:34pm Community Member, 279 Posts

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

23 August 2009 at 11:46pm Community Member, 279 Posts

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

24 August 2009 at 12:56am Community Member, 279 Posts

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

24 August 2009 at 11:11pm Community Member, 323 Posts

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

26 August 2009 at 5:11am Community Member, 279 Posts

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