|
|
|
|
|
Live Gadget "Special offers" |
What is it for? Don't miss the latest special offers of your preferred vendor. This example gadget displays a selection of 2 items from the weekly special offer list from a leading Swiss retail company including an image of the products. |
 Track the latest offer from your preferred vendor |
What do you need? Register on www.live.com or your local Live page and customize your Windows Live homepage. Go to "Add stuff", select “Advanced options” and add the gadget by entering its URL. Subscribe to it. |
How is it done? This simple gadget reads special offers from an external XML source and displays them to the user. It uses the normal display mode, so it is rendered using an iframe. The gadget was realised with one simple binding and displays most of its content using the innerHTML method. Because the gadget has to work in three different languages, there were some very simple helpers used to ease deployment.
The external data is registered as an XML source in the gadget manifest, so the Live.com Framework preloads it before the gadget is shown. Because the number of offers is very limited, we always load all offers to the memory and don't need any additional asynchronous calls. In the initialization method, the gadget parses the XML data using XPath and saves it in a random order to an array which the user can navigate trough, so he'll see every offer once before they get repeated.
Because there is no true support for internationalisation in the framework, the gadget has to exist in three separate version for the three languages. The gadgets share the same image files and nearly the same JavaScript files. Two things have to be changed in the code to change the language, one is to edit the setting in the configuration section and the second thing is to change the namespace of the gadget, so that a user can add two gadgets with different languages to the same Live.com page, i.e. a German and a French one. |