Appendix C. Repository FreeMarker Template API
Templates are widespread throughout Alfresco: They are used within the repository core to generate emails and activities, in the Explorer client to build custom views, at the remote REST API layer, and also as the default rendering mechanism for the Web Script and Surf Frameworks.
Alfresco provides a number of ways to process templates; REST-style URL, Web script components, and JSF UI components. In addition, AVM repository data can be processed in templates.
Multiple template engines are supported, with FreeMarker as the default. The template engine is not tied to any output file format: Templates can output entire HTML files as well as snippets of HTML, XML, JSON, or any other format desired. This makes them extremely flexible and appropriate for developing all kinds of solutions with Alfresco.
TEMPLATE FILES
Templates can be stored either on the classpath (for example, in alfresco/config/templates) or in the repository store.
Each template file will be specific to a particular template engine. The template service will pick the appropriate engine based on the file extension. By default, FreeMarker template files will be used. In the case of the Web Script and Surf Frameworks, FreeMarker is always selected as the template engine.
TEMPLATE MODELS
A model consists of a number of objects or a hierarchy of objects from which a template file retrieves values that can be used to dynamically generate the output. The model is like the API for the ...
Get Professional Alfresco: Practical Solutions for Enterprise Content Management now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.