Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
[#if content.imageLocation == "top"]
   …
[/#if]
替换值替换值:
Code Block
[#if content.date?has_content]
   ${content.date?time?string.short}
[#elseif content.endDate?has_content]
   ${content.endDate?time?string.short}
[#else]
   No date is set!
[/#if]

list

可在任何扩展Java集的集合里进行迭代。Can 可在任何Java集的扩展集合里进行迭代。Can iterate over any collection that extends a Java collection.

...

Code Block
[#include "/templating-kit/templates/content/myScript.ftl"]

...

Macros使您复用FreeMarker代码片段。参考宏指令使您复用FreeMarker代码片段。参考Templating Kit > Templates /templating-kit/components/macros里STK使用的例子。

Code Block
[#macro test foo bar="Bar" baaz=-1]
    Test text, and the params: ${foo}, ${bar}, ${baaz}
[/#macro]
[@test foo="a" bar="b" baaz=5*5-2/]
[@test foo="a" bar="b"/]
[@test foo="a" baaz=5*5-2/]
[@test foo="a"/]

定制Magnolia指令

Magnolia CMS provides the following custom directives:CMS提供一下定制指令:

对FreeMarker来说,这些指令都是由Directives类来完成的。此类可在Configuration应用的 > For Freemarker, these directives are implemented by the Directives class. This class is configured in the Configuration app > modules/rendering/renderers/freemarker/contextAttributes/cms/componentClass.For JSP, the directives are provided by the Templating JSP module.里配置。

对JSP,指令是由Templating JSP模块提供。

The directive syntax differs slightly depending on the templating language. Freemarker directives start with the # character in the case of standard directives and with the @ character for custom directives. All directives in the Magnolia cms tag library start with @. What follows is the tag library name such as cms, a dot character, the name of the macro, and any parameters. In JSP the limiting characters are different.

...