A question regarding the MyFriends RSS aggregator and RSS feeds in general came through sometime in December, but got lost in my inbox. So, I'm responding, now. Here is the question:

view plain print about
1I am wondering what the best way to add date information to the database so that we can display items like latest news that can be from any one of the feeds.
3Is there a way to pull the publishing date from the feed itself or a way to insert the date on our own to try and sort by date or to pull out the 10 latest news stories from 20 different feeds?

Is a way to add date information to the database? Yes, in fact I've been working on a modification to MyFriends to grab all the (potentially optional) RSS fields, including the pubdate field.

As far as CF is concerned, the publishing date coming through the XML is a text field. You should be able to get to it like this:

view plain print about

Pubdate is optional according to the RSS spec, so in the code, I'm doing a check similar to this:

view plain print about
1<cfset TempItem = MyXMLVar.xmlroot.channel.item[1]>
2 <cfif IsDefined("TempItem.pubDate") and IsDate(TempItem.pubDate.xmlText)>
3 Store Date
5 Else store null

This should be considered psuedo-code. You won't be able to copy and paste it to get it to work.

I'm storing the date field in the items table of the database. Once it's stored you can easily use SQL to get the top 10 latest stories from feeds, like this:

view plain print about
1select top 10 *
2 from items
3 order by pubdate desc

Ta Da! So, when will this 'updated' version of the RSS aggregator code be available? Beats me! As with all open source stuff, I'll get to it when I get to it.