Jan. 4: Magpie RSS for Flickr.
I've been messing around (poorly) with RSS feeds for a while and last week I came across Magpie RSS, a super simple php class to handle pretty much any feed you can throw at it. Right now the Asides page uses Magpie for the Delicious bookmarks and Flickr photos; the bookmarks were pretty straightforward but I was having some trouble displaying the photos correctly. This is pretty rough, but if you're looking for some sample code to plug in here's what I'm currently using:
if ($url) { // Set $url to your Flickr url
$rss = fetch_rss($url);
$count = 0;
foreach ($rss->items as $item) {
if ($count == 14) { break; // to limit it
} else {
$image = $item['description'];
$image_ary = explode("\n\n",$image);
$image_img = str_replace("_m.jpg", ".jpg", $image_ary[0]);
$image_img_ary = explode("</p>", $image_img);
$image = $image_img_ary[1];
$image = str_replace("<p>", "", $image);
$image = str_replace(".jpg", "_s.jpg", $image);
$image = preg_replace("/width="d+"/" , '', $image);
$image = preg_replace("/height="d+"/" , '', $image);
echo "$image";
} $count++; } }You can set $url to your Flickr rss feed, and make sure to include the mapgpierss file ;) I'm pretty sure I'm adding some unnecessary steps in there, but it gets the job done. Feel free to test it out or email me if you've got something.