Render the Content Layout
The render(params)
method of ContentLayout
renders a content layout from a template. The Mustache template is used by default for content layouts, but you can use any template technology you want.
The render(params)
method of ContentLayout
can use the following code to render the template with the data:
try {
// Mustache
template = Mustache.render(templateHtml, content);
if (template) {
$(parentObj).append(template);
}
// Dynamic DOM Manipulation can be done here
} catch (e) {
console.error(e.stack);
}
You can add the required data to the content
object created from params.contentItemData
. Oracle recommends that you merge the properties from params.scsData
into this object, so the template can make use of them too. The rendered template should be appended to the parent object passed to the render()
method.