Now blogging at diego's weblog. See you over there!

a google homepage module for ning photos

I spent a couple of hours last friday tinkering with the Google Personal Homepage (Apparenlty called "ig" or perhaps "iGoogle"? Am I the last one to notice this? Probably). How hard was it to create a module for in that would pull in data from a Ning app? The answer: not hard at all.

So what to do? I decided to write a simple module that would do a nice AJAXy slideshow of public photos posted to Ning Photos. Step one was creating the actual slideshow and making it work as a separate page, and here it is. Step two was taking that behavior and wrapping it in a way that IG would understand, and here is that.

From the POV of Ning development, there wasn't really much to at all. The IG modules were easy to write as well. Something did make me scratch my head for a while: Google is actually flowing content through their servers, and making some heavy mods to the Javascript functions that you can call. The Google Homepage API dev guide is actually pretty clear and straightforward, except for one tiny tiny detail: There's a section on "Writing Robust Modules" that discusses a couple of key things: first, you can't use document.getElementById(), you need to use Google's _get() instead. Similarly, you can't use XML HTTP request calls (typical AJAX stuff) -- you need to use Google's own content fetching thingies (_IG_FetchContent and the NSXL API). All of which is cool, except the docs don't say "you MUST use these functions", at best the docs say you should. My natural tendency (and that of most other devs as I figure it) would be to go and just use what we know unless you explicitly say no. And it took me a while to give up using standard Javascript calls and try Google's at which point everything worked nicely (the heavy caching they're doing of stuff didn't help a lot). My only comment then would be to add a big red box at the beginning of the docs that say "If you want to do X Y and Z use these functions instead of the common JS functions, otherwise your module won't work." Just a doc thing, but it would surely help. (see my follow up post here for more on this topic).

Anyway, it was a cool experiment. I'm thinking about other uses for it, probably a bookmarks module would be the most appropriate one to try next, since it's pretty useful IMO.

ps: if you want to try the module, you need to use the link for it and use the developer module to include it, since it's not yet "published" in Google's list of available modules.

ps 2: of course, all the sources for how the module and the photo view slideshow with fadeout works are accessible from within Ning, both for viewing and for cloned apps. :)

Categories: ning
Posted by diego on March 8 2006 at 10:08 PM

Copyright © Diego Doval 2002-2011.
Powered by
Movable Type 4.37