首页 > 解决方案 > 寻路器打印类作为手风琴的内容

问题描述

我有一个旧模板,我将 MODX 核心和附加功能从 2.2 更新到 2.6.5。更新后输出变得很奇怪。

这是我的手风琴代码:

<li [[+wf.classes]]>
    [[+wf.classnames:contains=`livello2`:eq=`livello2`:then=`<a class="goto_scheda" title="[[+wf.pagetitle]]">[[%cat.vai_scheda? &topic=`catalogo` &namespace=`plastitalia`]]</a>`:else=``]]
    <a [[+wf.classnames:contains=`livello1`:eq=`livello1`:then=`class="link_tassonomia"`:else=``]] href="[[+wf.link]]" title="[[+wf.pagetitle]]">[[+wf.pagetitle]]</a>
    [[+wf.wrapper]]
</li>

这是输出:

<ul class="sottomenu_catalogo">
    <li class="first livello2">
        first livello2
        <a first="" livello2="" href="/catalogo/packaging/category/product-ml-50" title="Product ml 50">Product ml 50</a>

    </li>
    <li class="livello2">
        livello2
        <a livello2="" href="/catalogo/packaging/category/product-ml-80" title="Product ml 80">Product ml 80</a>

    </li>

</ul>

有人对如何解决这个问题有一些想法吗?

标签: phptemplatesmodxwayfinder

解决方案


我错过了 :or 运算符,因此出于某种奇怪的原因,wayfinder 将条件打印为类。

<li [[+wf.classes]]>
    [[+wf.classnames:contains=`livello2`:or:eq=`livello2`:then=`<a class="goto_scheda" title="[[+wf.pagetitle]]">[[%cat.vai_scheda? &topic=`catalogo` &namespace=`plastitalia`]]</a>`:else=``]]
    <a [[+wf.classnames:contains=`livello1`:or:eq=`livello1`:then=`class="link_tassonomia"`:else=``]] href="[[+wf.link]]" title="[[+wf.pagetitle]]">[[+wf.pagetitle]]</a>
    [[+wf.wrapper]]
</li>

推荐阅读