Simple Example Gadget

Do the following to create and deploy a gadget:

Example Gadget

Use the following lines of code to build a simple gadget. This gadget displays the message "Hello, world!". Copy the following lines of code into a new file named hello_world.xml:

Code Snippet
Copy<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
  <ModulePrefs title="hello world example" /> 
  <Content type="html">
     <![CDATA[ 
       Hello, world!
     ]]>
  </Content> 
</Module>

Note the following about the "Hello World" example:

  • Gadgets are specified in XML. The first line is the standard way to start an XML file. This must be the first line in the file.

  • The <Module> tag indicates that this XML file contains a gadget.

  • The <ModulePrefs> tag contains information about the gadget such as its title, description, author, and other optional features.

  • The line <Content type="html"> indicates that the gadget's content type is HTML.

  • <![CDATA[ ...insert HTML here... ]]> is used to enclose HTML when a gadget's content type is html. It tells the gadget parser that the text within the CDATA section should not be treated as XML. The CDATA section typically contains HTML and JavaScript.

  • </Content> signifies the end of the Content section.

  • </Module> signifies the end of the gadget definition.

Note

For a Finesse specific example, download the LearningSampleGadget from https://github.com/CiscoDevNet/finesse-sample-code/tree/master/LearningSampleGadget, which provides step by step instructions in learning some of the objects in the finesse.min.js library.

Note

Portions of this page are reproduced from work created and shared by Google, see https://developers.google.com/terms/site-policies and used according to terms described in the Creative Commons 3.0 Attribution License, see https://creativecommons.org/licenses/by/3.0/. For more information about OpenSocial gadgets, see https://developers.google.com/gadgets/docs/overview. Note that not all OpenSocial gadget features are available in the Finesse container.