We just had our monthly Ruby Brigade meeting last night, and I shared for about how to create an easily customisable widget with Ruby On Rails (RoR).

BookJetty Widget

A simple framework that I used when creating BookJetty widget. Web widget has been like bread and butter for web 2.0 sites, it’s an amazing tool that will help to spread the word for your site, and with a good implementation will nurture happy and active users.

Creating a simple widget is easy, but how can you create one that can easily extended and customised to cater for more customisation and different types widgets in the future.

The easy way to create customisation parameters is by using URL paramters, but that can be confusing for your users, and make it hard for your users to customise it on the fly without having to use your widget customisation form.

Compare this widget URL:

<script language="javascript" type="text/javascript" src="http://www.domain.com/widget.php?username=nicky&show=random
&header=1&num=5&covers=small&text=all&tag=alltags&css=1&style=1&charset=&version=1">
</script>

And Google Adsense widget URL:

<script type="text/javascript"><!--
google_ad_client = "pub-32432432432432";
google_ad_width = 468;
google_ad_height = 60;
google_ad_type = "text";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "1465b7";
google_color_url = "1465b7";
google_color_text = "000000";
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

Google Adsense widget approach is just like the Amazon widget approach, it is using Javascript variables, and they are so much easier to customise, as compared to URL parameters.

These slides will help you to look at how I approached the widget creation following the best practices of the big guys, Google and Amazon widgets, and hope they will shed some lights. And happy widgeting.

4 Comments . Comments Feed . Trackback URI
Sat, 30 Jun 07 12:46 am . Dr Nic wrote:

The pdf seems to be corrupt.

Sat, 30 Jun 07 02:06 am . Herryanto Siatono wrote:

Thanks for spotting that Dr. Nic. It’s fixed.

Sat, 30 Jun 07 02:39 pm . Chu Yeow wrote:

I loved your presentation Herry! Lots of polish and smart little things and workarounds for browser bugs/restrictions that you won’t appreciate until you actually try to publish content that has to live in other people’s pages.

Sat, 30 Jun 07 04:43 pm . Herryanto Siatono wrote:

Chu Yeow, you too share lots of great tips, tricks, and gotchas on your blogs. Thanks for doing that too. :)

Add Your Comment



(optional)