Sharing simple.ftl across profiles
This article outlines the steps required to share a template across multiple profiles within a collection.
<#include> directive can be used to nest the content of another Freemarker template within a template file. This allows a simple template to be created that nests a shared template.
Customise the default template for the collection by designing the results page for the
Switch to the profile (e.g.
myprofile) with which the template should be shared and edit the template file.
Delete all the existing template code and replace with the following include statements:
<#ftl encoding="utf-8" /> <#if question.profile?exists> <#if question.profile?matches(".*_preview")> <#include "../_default_preview/simple.ftl"> <#else> <#include "../_default/simple.ftl"> </#if> <#else> <#include "../_default/simple.ftl"> </#if>
This will cause Funnelback to use the
_default/simple.ftl for the live view of
_default_preview/simple.ftl for the preview view of
myprofile when rendering out the template.
Conditional logic could also conceivably be used to set some variables that are read from the shared template.
If a user wishes to override the default shared template this code can be deleted and new custom template code used.
It is also possible to share templates by using symbolic links. However, this is not recommended because it is not clear to a user editing a template that they are actually editing a shared template. This means a user can easily customise a shared template without realising that their changes may affect other templates on the system.
Freemarker documentation: Freemarker include directive