Canvas Technology platform provides a mechanism to render templates (CTTPL files) using the Template Manager's API. The Template Manager is responsible for creating, loading, and processing all the template files.
The Template Manager's createTemplate method (API) enables you to render any template on to an object. TheĀ createTemplate API takes the following parameters:
Parameter | Data Type | Mandatory or Optional | Description |
---|---|---|---|
TemplateUrls | String | Mandatory | This parameter denotes the template URLs or the file names, which can be a string or an array of URLs. |
tmplParams | String | Optional | This optional parameter denotes the template parameters, which can be an array of values to be passed to the place holders of the templates. An empty object can also be passed as the parameter. |
basePath | String | Optional | This optional parameter denotes the template URLs. An empty object can be passed as the parameter. |
The createTemplate API returns the new instance of the Template Manager class.
Sample usage of the createTemplate API for application layout is as follows:
var tmpLayer = canvas.templateManager.createTemplate('al-app-footer.cttpl',AppFooter,canvas.util.getFWTemplatePath()); /* Here, * 'al-app-footer.cttpl' is the template file. * 'AppFooter' is the template parameter. * 'canvas.util.getFWTemplatePath' is the function that fetches the template path. */