message `
Look up a message from a resource bundle and perform variable substitution
=== Parameters ===
'''`key`''' A message resource name in a resource bundle[[BR]]'''` param*`''' Each variable substitution name and value to be replaced in the message
=== Examples ===
` You received a ${gift}`
`Default message`
{{{
#!html
os:name
}}}
''''''
Display a member's name, by passing an !OpenSocial Person object, 'viewer', 'owner', or a member id.[[BR]] Note: use of uid generates an !OpenSocial request. Use newFetchPeopleRequest for lists of members.
=== Parameters ===
'''`person`''' An !OpenSocial Person object to be used as the member[[BR]]'''` uid `'''The values 'viewer', 'owner', or the id of a member[[BR]]'''` linked `'''Set to true to have the name linked to the member's profile
=== Examples ===
` `
`{{{#!html os:profile
}}}`
{{{
#!html
os:profile
}}}
''''''[[BR]] Display a member's profile photo, by passing an !OpenSocial Person object, 'viewer', 'owner', or a member id.[[BR]] Note: use of uid generates an !OpenSocial request. Use newFetchPeopleRequest for lists of members.
=== Parameters ===
'''`person`''' An !OpenSocial Person object to be used as the member[[BR]]'''`uid`''' The values 'viewer', 'owner', or the id of a member[[BR]]'''` size`''' The size of the thumbnail, a 50x50 thumb or 100x100 small
=== Examples ===
` `[[BR]]` `
----
== hi5.template Functions ==
There are three core functions provided to work with templates and template related processing. You can parse templates from text, apply them, and perform message substitution in Javascript.
{{{
#!html
hi5.template.parse(templates_text)
}}}
Parse template text, such as from a Javascript string or a makeRequest call.
=== Parameters ===
'''` templates`''' One or more XML templates contained in a stylesheet tag[[BR]][[BR]]'''Return value''' None
=== Examples ===
`hi5.template.parse(document.getElementById('templates'));`[[BR]]`gadgets.io.makeRequest('http://www.hi5.com', function(response) { hi5.template.parse(response.data); });`
{{{
#!html
hi5.template.apply(template_name, output_element, context_data)
}}}
Recursively applies a template or template node and appends the result to an element node
=== Parameters ===
'''`input`''' A named element-id such as 'template', or an XML or browser DOM[[BR]]'''` output `'''A named element-id such as 'content', or a browser DOM node[[BR]]'''` context`''' A context object used to pass data to the template
=== Return value ===
None
=== Examples ===
`hi5.template.apply(document.getElementById('template'), 'content', {friends: data});hi5.template.apply('template', 'content', {owner: owner, viewer: viewer});`
{{{
#!html
hi5.template.message(resource_key, substitutions)
}}}
Look up a message from a resource bundle and perform variable substitution
=== Parameters ===
'''` resource`''' A resource name in message bundle[[BR]]'''` substitutions`''' A hash map of variable name substitutions to be replaced in the string
=== Return value ===
A string representing the message with variable substitution applied
=== Examples ===
`hi5.template.message('received_gift', {name: 'Joe', gift: 'pizza'});`