Thursday, October 26, 2006

Syndicating Content Using Widgets

Content widgets are self-contained bits of HTML that consist of HTML, Javascript and AJAX code required to fetch and display content from a remote site. These widgets typically have a fixed footprint and are implemented by including the html code for the widget in the html of the host page. This is simply a copy and paste operation, no further setup or integration are required.

For this example, we will use the Toronto Star’s sample code for including the Star’s headlines into a personal website or blog. The sample code for this example is available at: http://www.thestar.com/static/headlines/grabheadlines.html

Copying and pasting this nugget of HTML into a web page, displays a self-contained widget, 125 pixels wide that displays the Toronto Star headlines. The HTML relies on a remote script, http://www.thestar.com/images/xml/rss/news.js, located on the Toronto Star web server.

0 comments: