I have been looking into this as well, and I think I am seeing the same
issue.

If I have an example gadget with only a default view that looks
something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
 <ModulePrefs title="Basic Gadget">
   <Require feature="opensocial-0.8"></Require>
   <Require feature="dynamic-height"></Require>
   <Require feature="opensocial-data"></Require>
   <Require feature="opensocial-data-context"></Require>
   <Require feature="opensocial-templates"></Require>
   <Require feature="xmlutil"></Require>
   <Optional feature="content-rewrite">
        <Param name="include-tags"></Param>
   </Optional>
 </ModulePrefs>
 <Content type="html">
   <![CDATA[  
        <script type="text/os-data"
xmlns:os="http://ns.opensocial.org/2008/markup";>
            <os:ViewerRequest key="databindviewer"/>
            <os:OwnerRequest key="databindowner"/>
            <os:PersonAppDataRequest key="ownerdata" userId="@owner"
appId="@app"/>
        </script>
        <script type="text/os-template"
xmlns:os="http://ns.opensocial.org/2008/markup";
xmlns:example="http://example.org"; tag="example:myTemplate">
            <b>Hello ${databindviewer.displayName}</b><br>
                Welcome to ${databindowner.displayName}'s gadget<br>
            <b>Owner id is ${databindowner.id}</b><br>
            <b>Owner Data Key=name1
value=${ownerdata[databindowner.id]["name1"]}</b><br>
        </script>
        <script type="text/javascript">
            //var templateForMe =
opensocial.template.getTemplate("example:myTemplate");
            var templateForMe = os.getTemplate("example:myTemplate");
            templateForMe.process(); 
        </script>
   ]]>
  </Content>
</Module>

I can't get the opensocial javascript template api to actually render
out the template.  I receive a js error that opensocial.template is not
defined.  Do I have to have that template in a separate file for the
opensocial.template api to work?

-----Original Message-----
From: Stephens, Christopher 
Sent: Thursday, April 30, 2009 6:08 PM
To: [email protected]
Subject: Template JS API

SO I've been working for a few days to get some template logic working
and I have come to the conclusion that I think the opensocial.template
object isn't in the opensocial-templates feature library.  I checked the
mailing list for awhile and couldn't find anything to confirm this.  I
also brought up my gadget using the irf page and in firebug under DOM I
don't see a template object under the opensocial object.  I suppose I
might be missing a feature or something but can someone confirm if the
JS API is implemented in shindig?

Reply via email to