Source Code Discussion

This document outlines the source code for the XML Atom Feed + flickr API mashup located at http://vinoaj.com/google/mashup-blogckr/.

Primary User Interface - index.php

The entry point of the mashup is index.php. Although the page has a php extension, there is no PHP involved - the page is purely XHTML, CSS, and JavaScript.

The JavaScript methods written are primarily for making AJAX requests, and for manipulating and displaying the returned results.
The JavaScript code makes use of the Prototype library.

AJAX RPC functions

The following scripts are referenced by the AJAX requests in index.php.

ajax_common.inc.php

The following script is included at the top of all the RPC function scripts. It serves as a bootstrap script. It does 2 things:
1. Start output buffering.
2. Provide a generic error output function.

read_blog.php

This script retrieves an RSS Atom XML feed and returns an XML document containing all the titles returned by the feed.

lookup_flickr.php

This script takes a phrase, turns it into a comma-separated keyword list, and requests flickr to return 100 photos satisfying the keywords. The flickr feed is then parsed, URLs generated for the thumbnail images and full images; and these are then returned in the form of an XML document.