It can be a pain to create the entire Gadget structure for each of your opensocial apps, so it's nice to have a template file.
Our Opensocial template file is currently very simple, but it does save quite a bit of time. (and sometimes some frustration)
The basic structure of the opensocial application
is already laid out in this template, and many Module Preferences are already defined.
Just fill in the blanks and start coding.
Note that we use a few preference items from the Google Gadgets API. Please
Read the Gadgets API Definition for further information.
Here's the code: Here is our current, in-house template file that we use for our opensocial applications.
<?xml version='1.0' encoding='UTF-8' ?>
<Module>
<ModulePrefs
title='Application Title'
title_url='http://www.iwiddit.com/'
description='This is my app.'
author=''
author_email=''
screenshot=''
thumbnail=''
directory_title=''
author_affiliation=''
author_location=''
author_photo=''
author_aboutme=''
author_quote=''
author_link=''
show_stats=''
show_in_directory=''
width=''
height=''
category=''
category2=''
singleton=''
scaling=''
scrolling=''
>
<Require feature='opensocial-0.7' />
<Optional feature='setprefs' /> <!-- gadgets.Prefs -->
<Optional feature='dynamic-height' /> <!-- gadgets.window -->
<Optional feature='settitle' /> <!-- gadgets.window.setTitle -->
<Optional feature='skins' /> <!-- gadgets.skins -->
<Optional feature='views' /> <!-- gadgets.views -->
<Optional feature='rpc' /> <!-- gadgets.rpc -->
<Optional feature='flash' /> <!-- gadgets.flash -->
<Optional feature='minimessages' /> <!-- gadgets.MiniMessage -->
<Optional feature='tabs' /> <!-- gadgets.tabs -->
</ModulePrefs>
<Content type='html' view='profile'>
<![CDATA[
<style type='text/css'>
/* profile style here */
</style>
<!-- profile html here... -->
<p>Profile Data</p>
<script type='text/javascript'>
// profile code goes here
</script>
]]>
</Content>
<Content type='html' view='canvas'>
<![CDATA[
<!-- Note: You don\'t need to specify separate content for canvas vs profile unless you want to. You can also generate the contents programatically. See the gadgets namespace description. -->
<style type='text/css'>
/* canvas style here */
</style>
<!-- canvas html here... -->
<p>Canvas Data</p>
<script type='text/javascript'>
// canvas code goes here
</script>
]]>
</Content>
</Module>