PDA

View Full Version : gfeedfetcher sorting



jrichview
04-09-2013, 08:36 PM
1) Script Title: gfeedfetcher

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex18/gajaxrssdisplayer.htm

3) Describe problem: I've added 3 feeds and told it to sort by date, but rather than sort ALL items by date it seems to sort each feed by date and append?

EXAMPLE:

var newsfeed=new gfeedfetcher("example3", "example3class", "_new");
newsfeed.addFeed("John Viele", "http://social.msdn.microsoft.com/Profile/u/activities/feed?displayName=John%20Viele");
newsfeed.addFeed("Mark Alexander", "http://social.msdn.microsoft.com/Profile/mark.alexander/activity");
newsfeed.addFeed("NPR Tech", "http://www.npr.org/rss/rss.php?id=1019");
newsfeed.displayoptions("label datetime snippet"); //show the specified additional fields
newsfeed.setentrycontainer("p"); //Display each entry as a paragraph
newsfeed.filterfeed(25, "label", "date"); //Show X entries, sort by date
newsfeed.init(); //Always call this last

This gives me output everything from first feed, then everything from third feed. Some reason it doesn't show second feed items. I haven't doublechecked on the url yet.

jrichview
04-10-2013, 05:55 PM
Nevermind. I debugged into the script and figured out what was going on.

First, that "filterfeed" call above only has 2 params, so "label" shouldn't be a param there. Also, I've added a 3rd param to "filterfeed" function to make it possible to specify how many items to pull from each feed before trying to sort and filter. This makes it possible to sort by date, and only show the 20 most recent entries over all feeds.