I'm pondering the best way to do this - I have a group of people with blogs, and want to show the latest post by each of them, alongside their favicon, on the homepage.
9rules does this really nicely - do you think they are simply using an RSS parser to grab the info? (I'm guessing it caches this as well to save bandwith)
Would this be hard to do with Wordpress? Has anyone done something similar?
Keith Devens has an excellent PHP XML library. If you have access to the WP code, and aren't afraid of arrays, it should be relatively simple to implement. I use it to populate news pages and to grab events from google calendar.
I use magpie as well with something i was working on for a client who had the same question as you (sort of). They wanted to include RSS from various sources for a variety of reasons -- they needed a solution that wasn't too tech heavy and wasn't environment dependent (ex: PHP).
I've got a rough and ready idea up at http://www.creativeyoungteam.com/ but already have a few problems - some peope didn't have favicons, or even a title assigned to their rss feed!
But I like the idea of coding something from scratch, ajax could be a nice way to show a select of recent news items on rotation, instead of just the one...
If you choose to code ajax from scratch, you'll probably get familiar with the limitations of the xmlhttprequest object, as this quote from Apple explains:
"...Second, the domain of the URL request destination must be the same as the one that serves up the page containing the script. This means, unfortunately, that client-side scripts cannot fetch web service data from other sources, and blend that data into a page."
There is a workaround to this, involving some php, but one should pay attention to security issues while doing so. In any case, all you need is lightweight ajax (prototype or prototype lite from moo.fx, for example) and literally a coulple lines of php code. The xml parser could be either ajax or php, depending on how much you choose to rely on javascript.
The simplest way to do this might be the following: 1) Make an array where you place the feed addresses 2) use some php to parse the xml into an array, for example 3) print out the title and content from the array 4) call this program from ajax
This way you won't have to deal with the xmlhttprequest so much, as you are only requesting the one php-file from your own domain. The ajax request might look like this:
new Ajax.PeriodicalUpdater('mydiv', 'feed-grabber.php', {asynchronous:true, frequency:2; parameters: feed=0});
This would update a div id'd "mydiv" every two seconds with data from feed-grabber.php, which in turn has parsed the 0 feed (the first one from the feed array). I could email you a working sample, if you aren't particularly interested in writing code.
That, by the way, is a really basic example where all the feeds must be in RSS2.0 format. And also, the line about Ajax.PeriodicalUpdater I posted earlier has a few typos at least...
Oh, you can email me at (my username) @ gmail.com, if you want the source. It took like 25 minutes to code and to set up, so it might not be perfect, but at least it works.