The full code for this sample is available at https://github.com/jcleblanc/programming-social-applications/blob/master/chapter_7/pipeline_with_templating.xml.
We’ve explored the vast potential and power in both data pipelining and templates, which integrate rich data sets and visualization templates, respectively, into a gadget. Alone, each feature is a wonderful addition to any gadget, but their power really lies in being married into one cohesive unit.
Let’s take a look at an example of how we can merge these two technologies together to build out a data set based on the result set of an external data source. In this example, we want to scrape the main page of http://www.reddit.com to capture its top headlines. Using this data source, we want to display all links within our gadget.
Our first task is to build out the
ModulePrefs section of
our OpenSocial gadget, integrating all data pipelining and templating
<?xml version="1.0" encoding="utf-8"?> <Module> <ModulePrefs title="Reddit Headline Fetch" title_url="http://www.jcleblanc.com" description="Obtains reddit.com headlines via YQL using data pipelining and visualizes using OS templates" author="Jonathan LeBlanc"> <Require feature="opensocial-0.9"/> <Require feature="opensocial-data" /> <Require feature="opensocial-templates" /> </ModulePrefs>
ModulePrefs node, we
need to set up the
Require elements for the features that we will need in our gadget. For this use case, ...