FTL ファイルにマクロを追加する場合は、マクロ ファイルを目的の FTL ファイルにインポートし、目的の FTL ファイルを画面に表示します。ここに簡単な例があります
にマクロ FTL ファイルを作成します。webroot/screen/includes/MacroExample.ftl
<#macro macroExample>
This is a macro example
</#macro>
にファイルをインポートします。Header.html.ftl
<#import "MacroExample.ftl" as m> <#-- If the macro file in different directory you can use the relative path -->
<@m.macroExample/>
これは、次のコードによってファイルにHeader.html.ftlレンダリングされますwebroot.xml
<render-mode>
<text type="html" location="component://webroot/screen/includes/Header.html.ftl"/>
</render-mode>
これmacroExampleで、ヘッダーに表示されます。これは通常の例です。この手順に従って作業できます。