我想知道如何使用设置了主题的Diazo为body标签添加一个类。
我会使用if-content
检查portal-column-two
是否存在,并根据此情况将一个类放入正文标记。
一个解决方案是:
<replace theme="/html/body/@class">
<xsl:attribute name="class"><xsl:copy-of select="." /> three_col</xsl:attribute>
</replace>
并在此处描述: Add class to body tag using diazo with notheme但只有在设置了notheme时才有效。
那么如何在运行中将一个简单的附加css类放入body标签?
编辑: 这适用于纯粹的重氮与主题和Plone(plone.app.theming):
<before theme-children="/html/body"><xsl:attribute name="class"><xsl:value-of select="/html/body/@class" /> three_col</xsl:attribute>
</before>
根据条件:
<before theme-children="/html/body" css:if-content="#portal-column-two">
<xsl:attribute name="class"><xsl:value-of select="/html/body/@class" /> three_col</xsl:attribute>
</before>
<before theme-children="/html/body" css:if-not-content="#portal-column-two">
<xsl:attribute name="class"><xsl:value-of select="/html/body/@class" /> two_col</xsl:attribute>
</before>
答案 0 :(得分:2)