Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Blog module -- RSS widget isn't grabbing articles by date

Our old forums are still available as a read-only archive.

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

Page: 1
Go to End
Author Topic: 1729 Views
  • iandouglas736
    Avatar
    Community Member
    8 Posts

    Blog module -- RSS widget isn't grabbing articles by date Link to this post

    So my biggest annoyance right now is that adding a new BlogEntry item adds it way down at the bottom of my list, so using the "drag-to-move" feature never gets used by me.

    Unfortunately though, it seems the list's sort order is used by the RSS widget, and pulls articles based on the 'Sort' field in the SiteTree table, which seems kinda backwards -- RSS feeds are generally date-based, and it should be grabbing the newest articles based on the date.

    Anyone have any idea on how to hack the RSSWidget.php code to pull the data based on the date instead of the 'sort' field?

  • iandouglas736
    Avatar
    Community Member
    8 Posts

    Re: Blog module -- RSS widget isn't grabbing articles by date Link to this post

    After chatting with simon_w in IRC, he figured out the fix:

    modify /blog/code/BlogHolder.php
    change the rss() function, around line 186, from this:

    function rss() {
    global $project;
    $rss = new RSSFeed($this->Children(), $this->Link(), $project . " blog", "", "Title", "ParsedContent");
    $rss->outputToBrowser();
    }

    to this:

    function rss() {
    global $project;
    $children = $this->Children();
    $children->sort('Date', 'DESC');
    $rss = new RSSFeed($children, $this->Link(), $project . " blog", "", "Title", "ParsedContent");
    $rss->outputToBrowser();
    }

    Thanks, simon_w !!

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