Jump to:

1851 Posts in 1606 Topics by 561 members

Blog Module

SilverStripe Forums » Blog Module » RSS feed for blog entries with a certain tag

Discuss the Blog Module.

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

Page: 1
Go to End
Author Topic: 1298 Views
  • baba-papa
    Avatar
    Community Member
    279 Posts

    RSS feed for blog entries with a certain tag Link to this post

    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.

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: RSS feed for blog entries with a certain tag Link to this post

    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.

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: RSS feed for blog entries with a certain tag Link to this post

    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.

  • Juanitou
    Avatar
    Community Member
    323 Posts

    Re: RSS feed for blog entries with a certain tag Link to this post

    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

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: RSS feed for blog entries with a certain tag Link to this post

    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

    1298 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.