2012-11-16 6 views
7

テーマを設定してDiazoを使ってbodyタグにクラスを追加する方法は不思議です。 を使用して、portal-column-twoが存在するかどうかを確認し、これに応じてクラスをbodyタグに入れます。テーマを持つdiazoを使ってボディタグにクラスを追加する

、ここで説明されています:

一つの解決策はある Add class to body tag using diazo with nothemeが、nothemeが設定されている場合にのみ機能します。

したがって、単純な追加cssクラスをbodyタグに追加するにはどうすればよいですか?

EDIT: このテーマとし、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> 

私の最終的な解決策がここに記述されています:https://plone-theming-with-diazo.readthedocs.org/en/latest/snippets_diazo/recipes/index.html#add-css-class-depending-on-existing-portal-columns

+1

リトル関連、ここではPythonでボディクラスを追加する方法です:http://developer.plone.org/templates_css_and_javascripts/css.html#adding-new-css-body-classes –

+1

ミックコ、あなたの答えのためのthxしかし、私は純粋なDiazo/XSLTソリューションを探しています。 – MrTango

+0

私はこの質問に答えていないのだろうか? – romanofski

答えて

関連する問題