In Alfresco, I have multiple workflows in which i send an email based on certain events. Each e-mail template uses the same layout and design. Therefore, I want to import a "shell" template and pass in different variables based on the type of workflow and event.
// lib/utils.html.ftl
<#macro shell greeting>
${greeting}
</#macro>
So as example, I have a task-assignment.ftl
template, where I want to import my base template.
// task-assignment.html.ftl
<#import "./lib/utils.html.ftl" as utils>
<#assign greeting="${greeting!'Hello User'}" />
<@utils.shell greeting />
My problem is the value of the path to the file in the Freemarker <#import >.
I can't figure out how to get the path in a format that Freemarker understands and Alfresco can provide.
var file = companyhome.childrenByXPath("/app:company_home/app:dictionary/app:email_templates/cm:test/cm:utils.html.ftl");
logger.log(file[0].url) => /d/d/workspace/SpacesStore/08234083-23948234-2349834/utils.html.ftl
<#import file as utils>
Caused by: freemarker.core._MiscTemplateException: Error reading imported template string://d/d/workspace/SpacesStore/08234083-23948234-2349834/utils.html.ftl
Does anyone know, how to get the path to the file in a format that Freemarker is happy with and Alfresco is able to provide?
I'm using Freemarker version 2.3.20 and Alfresco Community version 6.1.2.