【发布时间】:2021-04-19 16:58:29
【问题描述】:
在 Alfresco 中,我有多个工作流程,我根据某些事件发送电子邮件。每个电子邮件模板都使用相同的布局和设计。因此,我想导入一个“shell”模板,并根据工作流和事件的类型传入不同的变量。
// lib/utils.html.ftl
<#macro shell greeting>
${greeting}
</#macro>
例如,我有一个task-assignment.ftl 模板,我想在其中导入我的基本模板。
// task-assignment.html.ftl
<#import "./lib/utils.html.ftl" as utils>
<#assign greeting="${greeting!'Hello User'}" />
<@utils.shell greeting />
我的问题是 Freemarker 中文件的 path 值。
我不知道如何以 Freemarker 理解且 Alfresco 可以提供的格式获取路径。
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
有谁知道,如何以 Freemarker 满意且 Alfresco 能够提供的格式获取文件的路径?
我使用的是 Freemarker 2.3.20 版和 Alfresco Community 6.1.2 版。
【问题讨论】:
标签: alfresco freemarker alfresco-share