插槽 <isslot> 标记周围的条件

Condition around slot <isslot> tag

我想知道是否可以围绕插槽设置条件,检查它是否已配置,然后显示不同的标记。

代码示例:

<isif condition="${The slot is configured}">
    <isslot id="error-page-text-widget" context="folder" description="Error page text widget" context-object="${pdict.Widgets.contextFolder}" />
<iselse>
    Other stuff
</isif>

是的,这是可能的。您还可以在特定的 else 条件下显示另一个插槽。要记住的一件事是,业务经理不会选择包含的模板插槽。因此,您还需要将它们放在包含模板中。但是您可以使用 <isif condition="${false}"></isif> 环绕它来抑制包含模板中的输出。

你可以这样做:

<isif condition="${pdict.Widgets.contextFolder != null}">
      <isslot id="error-page-text-widget" context="folder" description="Error page text widget" context-object="${pdict.Widgets.contextFolder}" />
</isif>

您可以像下面代码一样检查插槽是否为空:

<isif condition="${slotcontent != null}"> <isslot id="homepage-online-advantages-slot" description="homepage-online-advantages" context="global"/> </isif>