Templates design
This tutorial will introduce you to a view of what FreeMarker templates are and how you can use them to customize your KODO server.
FreeMarker is a simple yet powerful template engine that KODO uses whenever administrator is allowed to customize part of the KODO portal. In particular, it’s used to allow customization of e-mails that are sent by KODO and myKODO download page.
In FreeMarker, you define templates, which are text files that contain the desired output (Html in case of KODO), except that they contain placeholders like ${username}
, and even some logic like conditionals. KODO will supply the actual values for these placeholders and the final output is generated based on this input.
Here is an example of a simple FTL file:
In the template, use standard HTML+CSS features to define the appearance. CSS can be either included directly in the template file or saved externally in a dedicated file.
With KODO you can also use the FTL tag <#if expression>...</#if>
it's similar to HTML tags, but they are instructions to FreeMarker and will not be printed to the output.
Example:
Some placeholders may return NULL string if some information has not been set up. You can check it using the FTL tag <# variable??> ... </#if>
. If the variable contains NULL, the content between tags will not be displayed.
Example:
Some of the variables will store the collection of items that need to be displayed. In that case, you will need to use the list tag:
Example:
Example output:
KODO will look for the template.ftl file in the following paths:
E-mail template for admin access of newly created organization
/opt/StorwareData/templates/adminAccess
E-mail template for user password change
/opt/StorwareData/templates/changePass
E-mail template for deployment e-mail
/opt/StorwareData/templates/deploy
E-mail template for daily report
/opt/StorwareData/templates/newsletter
If the template file is not found default will be used.
Last updated