Results 1 to 4 of 4

Thread: sort rss by date (gAjax RSS Feeds Displayer)

  1. #1
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default sort rss by date (gAjax RSS Feeds Displayer)

    1) Script Title: gAjax RSS Feeds Displayer

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...sdisplayer.htm

    3) Describe problem:

    i seem to be having a problem with the sorting of feeds using the gAjax RSS Feeds Displayer script. actually, i am using both a feed scroller and just a static display - the scroller works fine, but the static display only shows the earliest post and not the most recent.

    basically, i am using the static display so that page content can be updated using an rss feed. it doesn't/shouldn't scroll or change in this case. i haven't done anything to the original code at all, other than to specify that one result display (and is sorted by date as in the original code).

    i have been patient and done updates over the space of a few days, as i am aware that the google api dates time to refresh, but my original post is still displaying. as i say, the other ticker/scroller workes fine, and the results appear one-by-one in the correct order - so i'm sure the sort functions are working properly.

    any ideas?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Two.

    1. In the example on the demo page, there is a typo:

      Code:
      cssfeed.filterfeed(10, "title") //Show 10 entries, sort by date
      That should be date. If you are using title that could be it.


    2. In the gfeedfetcher.js script, it prunes the feed items using the Google API before it sorts them. This (in the case of only one item) would of course mean that it takes the first item.


    I think it's probably this second issue. I'm imagining that as items (posts in this case) are added to your feed, they're added at the bottom. That would make the earliest item/post always the first. If you can change how items are added to the feed, adding them to the top instead, that should take care of it.

    Other than that, you would have to specify the number of items as equal to or greater than the total number, then prune it to one later, after the sort, via a bit of custom code and/or css.
    Last edited by jscheuer1; 08-09-2010 at 12:11 AM. Reason: precision
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks.

    i'll give your second option a try. it's not a problem sorting the order of the post at the moment, but i'm not sure how some of the rss editors might sort the items in the xml file - i'm just thinking about how to make it possible for a non-programmer to add content without a big headache (wishful thinking).

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm thinking that most feeds work this way - newest at the top. Otherwise, much of what the Google API does wouldn't make sense. Even putting the Google API aside for a moment - say you're subscribing to a feed with your browser (many do this now), what do you want to see at the top of the list, the oldest or the newest item?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •