【发布时间】:2018-02-20 16:32:01
【问题描述】:
我目前正在处理一个组件,我需要一个 if else 语句来过滤页面对象是否为空,这是我的尝试:
[#assign page = cmsfn.page(component)]
[#if page IS NULL ] // not working...
[@cms.component content=cmsfn.asContentMap(component) editable=false/]
[/#if]
还有这个
[#assign page = cmsfn.page(component)]
[#if !page?has_content ] // not working...
[@cms.component content=cmsfn.asContentMap(component) editable=false/]
[/#if]
我在这里要做的是,如果页面对象为 null ,则进行组件渲染,这些页面对象是 jrc 子节点,在渲染组件时这种类型的节点会弄乱模板,所以我需要过滤输出并确保页面为空,然后渲染。
有什么建议吗?请给我一个代码示例。 谢谢
【问题讨论】:
标签: nodes freemarker jcr magnolia