Client Side Template
{*partial partialName}
Description
Adds partial sections of data into the template.
Partial templates are named sub-templates and are only really usefull if you using your own expander and is therefore somewhat difficult to demonstrate in the Template Tester. A template can reference these partial templates using the {*partial partialName} command. This is useful if a template has text that is repeated. For example, consider the following Javascript code:
//define the data
var _d = {firstname: 'Fred', lastname: 'Smith'}
//define the template
var arr = [];
arr.push('Welcome<br>');
arr.push('Hello {firstname} {lastname}<br>');
arr.push('{*partial partial1}');
var _t = arr.join('\n');
//define the settings object (template and partials)
var settings = {
template: _t,
partials: {
partial1: 'from partial1: {firstname} {lastname}<br>'
}
}
//merge the data into the template
var html = A5.u.template.expand(_d,settings);This will produce the following output:
Welcome
Hello Fred Smith
from partial1: Fred Smith
Hello Fred Smith
from partial1: Fred Smith