The best way I can think of to do that is by adding all of the entry objects to 
a single entries array and use the array's sort method with a custom sort 
function like the one below:

function sortMethod(a, b){
  return (new Date(a.publishedDate)).getTime() - (new 
Date(b.publishedDate)).getTime()
}

If you want to sort them in reverse order (i.e., most recent first), simply 
switch the a and b references in there.
Jeremy R. Geerdes
Generally Cool Guy
Des Moines, IA

For more information or a project quote:
[email protected]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Apr 14, 2011, at 6:54 AM, voriand wrote:

> Great, with an array of rss feed URLs it goes through it :) Thank you!
> 
> My problem is now, that how can i sort the result feeds by date?
> 
> Now the script is listing all results sorted by the feed urls, but how
> can i store the results (entrys) in an array, and sort this by date?
> 
> On Apr 13, 5:27 pm, Jeremy Geerdes <[email protected]> wrote:
>> Yes, you can use the same onload method with all the feeds you need to 
>> create, but this one will need to be rewritten a bit. I would suggest 
>> putting your feed urls in an array and looping through that. You'll also 
>> need to check into your callback method to make sure that it will 
>> accommodate the multiple feeds as you want it to. And you might need to read 
>> up on method closures if you're going to get too fancy.
>> 
>> Jeremy R. Geerdes
>> Generally Cool Guy
>> Des Moines, IA
>> 
>> For more information or a project quote:
>> [email protected]
>> 
>> If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan 
>> Church!
>> 
>> On Apr 13, 2011, at 8:55 AM, voriand wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi!
>> 
>>> How can i go through multiple feeds the fastest way with this script?
>> 
>>>    function OnLoad() {
>>>      // Create a feed instance that will grab Digg's feed.
>>>      var feed = new google.feeds.Feed("http://services.digg.com/2.0/
>>> story.getTopNews?type=rss");
>> 
>>>      feed.includeHistoricalEntries(); // tell the API we want to have
>>> old entries too
>>>      feed.setNumEntries(250); // we want a maximum of 250 entries, if
>>> they exist
>> 
>>>      // Calling load sends the request off.  It requires a callback
>>> function.
>>>      feed.load(feedLoaded);
>>>    }
>> 
>>> Can i call this onLoad method with all the feed URLs i need?
>> 
>>> I need to read about 20-30 feeds and search for specified feeds (has a
>>> string in title or in snippet) and show just this feed items. But for
>>> this i have to get through all the feed URLs...
>> 
>>> Thank you very much!
>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "Google AJAX APIs" group.
>>> To post to this group, send email to 
>>> [email protected].
>>> To unsubscribe from this group, send email to 
>>> [email protected].
>>> For more options, visit this group 
>>> athttp://groups.google.com/group/google-ajax-search-api?hl=en.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google AJAX APIs" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-ajax-search-api?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to