Changes between Version 21 and Version 22 of hi5TemplateLibraryDocumentation
- Timestamp:
- 07/21/08 16:10:05 (16 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
hi5TemplateLibraryDocumentation
v21 v22 7 7 <ol> 8 8 <li><a href="#Overview">Overview</a></li> 9 <li><a href="#HowTo ">How to add templates to your code</a></li>10 <li><a href="#Down ">Downloading the library</a></li>9 <li><a href="#HowToAddTemplatesToYourCode">How to add templates to your code</a></li> 10 <li><a href="#DownloadingTheLibrary">Downloading the library</a></li> 11 11 <li><a href="#hi5.templateTags">hi5 Template Tags</a></li> 12 12 <li><a href="#hi5.templateFunctions">hi5 Template Functions</a></li> … … 17 17 }}} 18 18 == Overview == 19 The hi5.template library is a browser side, Javascript library which enables you to fuse Javascript data and logic into your HTML. It simplifies writing localized apps by providing a message resource tag, <os:message key=”resource” />, which eliminates the need to build messages and HTML with Javascript. To ease transitioning to language resource files, you can provide the message resource directly in the message tag. For example: <os:message key=”received_gift” gift=”pizza” friend=”Joe”>You received a ${gift} from ${friend}</os:message>. Also, using the hi5.template library allow future compatibility with our user generated content inline-translation tool. 19 The hi5.template library is a browser side, Javascript library which enables you to fuse Javascript data and logic into your HTML. It simplifies writing localized apps by providing a message resource tag, <os:message key=”resource” />, which eliminates the need to build messages and HTML with Javascript. To ease transitioning to language resource files, you can provide the message resource directly in the message tag. For example: <os:message key=”received_gift” gift=”pizza” friend=”Joe”>You received a ${gift} from ${friend}</os:message>. Also, using the hi5.template library allow future compatibility with our user generated content inline-translation tool. 20 20 21 21 The template is straightforward, with only a few conventions: ${} for variable substitution, <for-each> for iteration, <if>/<else> for conditional logic, and <!os:message> for gadget resource localization. There is also a <set> tag for storing the output of tags, and <!os:name> and <!os:profile-pic> convenience tags.[[BR]][[BR]]The library is based on XML templates, which can be embedded in `<script type="text/xml">` tags or loaded remotely with `gadgets.io.makeRequest()`. Here's an example which iterates over an array of friends and displays their thumbnail photo:[[BR]][[BR]]'''application.xmlt'''[[BR]][[BR]]`<stylesheet xmlns:os="http://www.w3.org/1999/xhtml"> ` … … 44 44 45 45 ---- 46 == How To Add Templates To Your Code === 46 == How To Add Templates To Your Code == 47 Here’s an example of where you would put the library in your application XML: <Content type="html" quirks="false" view="default"><![CDATA[ 47 48 48 49 Here’s an example of where you would put the library in your application XML: 50 51 <Content type="html" quirks="false" view="default"><![CDATA[ 52 <link rel="stylesheet" type="text/css" href="http://www.company.com/app/application.css"> 53 <div id="page-content"></div> 54 <script type="text/javascript" src="http://www.company.com/hi5_template_20080430.js"></script> 55 <script type="text/javascript" src="http://www.company.com/app/application.js"></script> 49 <link rel="stylesheet" type="text/css" href="http://www.company.com/app/application.css"> <div id="page-content"></div> <script type="text/javascript" src="http://www.company.com/hi5_template_20080430.js"></script> <script type="text/javascript" src="http://www.company.com/app/application.js"></script> 50 56 51 </Content> 57 52 58 == Downloading The Library === 59 60 Here’s the zip file with library and documentation: 61 62 http://static.hi5.com/images/opensocial/hi5_template_20080430.zip 53 == Downloading The Library == 54 Here’s the zip file with library and documentation: http://static.hi5.com/images/opensocial/hi5_template_20080430.zip 63 55 64 56 == hi5.template Tags ==