Template
From AlfrescoWiki
The template component provides rendering of Template text files against a Model data using a pluggable templating system. See the Template Guide for more information on template files and data models.
Contents |
See Also: Template Guide
Back to: Component Library
[edit] Tag details
<r:template id="<string>" rendered="<boolean>" engine="<string>" template="<string>" mandatory model="<method-binding>" />
Alfresco 2.0 Tag Details:
<r:template id="<string>" rendered="<boolean>" engine="<string>" template="<string>" templatePath="<string>" model="<method-binding>" />
[edit] Custom Tag attributes
[edit] engine
The identifier of the templating engine to use. These come from the web-client-config.xml definitions. If no engine is provided then the FreeMarker default engine will be used.
[edit] template
The location of the template text file. The template file can either be located on the ClassPath (e.g. in the folder alfresco/templates under WEB-INF/classes for a TomCat installation) or in the Repository.
- Therefore this attribute should be set to either a classpath resource such as alfresco/templates/example.flt or bound to a NodeRef value to a content node in the repository.
[edit] templatePath
-Available in Alfresco 2.0' - The cm:name based path to the template to render. For example "/Company Home/Data Dictionary/Presentation Templates/my_docs.ftl".
[edit] model
The model to process the template file against. If no model is provided then the default will be used. Information on the default model and providing custom models can be found here in the Template Guide.
[edit] Example
Example showing the template component using the default model and a template file on the classpath:
<r:template template="alfresco/templates/example.flt" />
Example showing the template component using a custom model and a template file from the repository:
<r:template template="#{MyBean.templateNodeRef}" model="#{MyBean.templateModel}" />
[edit] Screenshots
See the Template Guide examples.

