2011-05-04 70 views
1

我使用的Plone 4.0.1 + collective.xdv 1.0rc11,我需要使用不同的主題。collective.xdv - 定義替代主題遊變換的默認主題

我試圖描述in a recent question/answer做,但是當我插入一個新的主題有一個條件我沒有得到任何改變,在所有的默認主題。這裏是什麼,我嘗試了一些例子:

<rules css:if-content="body.section-mysection"> 
    <theme href="mysection.html" /> 
</rules> 

此結束在:

Traceback (innermost last): 
    Module ZPublisher.Publish, line 132, in publish 
    Module zope.event, line 23, in notify 
    Module zope.component.event, line 26, in dispatch 
    Module zope.component._api, line 138, in subscribers 
    Module zope.component.registry, line 323, in subscribers 
    Module zope.interface.adapter, line 575, in subscribers 
    Module plone.transformchain.zpublisher, line 93, in applyTransformOnSuccess 
TypeError 

雖然這些:

<theme href="mysection.html" if-path="/mysection/"/> 

<theme href="mysection.html" css:if-content="body.section-mysection"/> 

兩個工作,爲給定部分但對於門戶網站的其餘部分根本沒有變化。

我試圖用<theme href="index.html" />在rules.xml中指定默認主題(即使它已經註冊到@@ xdv-settings)但沒有運氣。

缺少什麼我在這裏?

由於提前, SIMO

回答

2

首先,我會考慮移動到plone.app.theming。按我的理解(http://pypi.python.org/pypi/plone.app.theming#migrating-from-collective-xdv)和p.a.theming提供了所有下collective.xdv而開發的最新和最強大的功能升級/改變相當微不足道。

其次,我將引用此文件:

這聽起來像你只需要配置默認主題第一,然後添加一個條件(S)改變條件匹配時的適當部分。額外匹配的主題不應該影響「默認」(第一個匹配的)主題。

+0

嗨Alex,謝謝!我會嘗試,但文檔說「plone.app.theming與Plone 4.1或更高版本一起工作。」是否有任何解決方法/ backport知道嗎? – simahawk 2011-05-05 09:35:05

+0

哦!不,對不起,我猜對於<4.1 collective.xdv仍然是最好的選擇 – aclark 2011-05-08 20:13:30

+0

應該可以得到plone.app。主張與Plone 4.0一起合適的KGS工作,但我沒有時間來保持自己,Plone 4.1即將到來。 – 2011-05-11 12:21:01

1

我不知道如果我理解你的設置和具體的問題,以充分延長,所以我只是張貼工作的例子。注意:我們不會在XDV控制面板使用default theme值,因爲這將是過時與plone.app.theming反正。這也似乎與在rules.xml中直接,這可能是相關的特定問題/用例,建立主題tempaltes干涉。

<rules 
xmlns="http://namespaces.plone.org/xdv" 
xmlns:css="http://namespaces.plone.org/xdv+css" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 

<theme css:if-content="body.section-front-page" href="frontpage.html"/> 
<theme css:if-content="body.section-contact" href="contact.html"/> 

<!-- Only style actual Plone page and exclude things like /manage --> 
<rules css:if-content="#visual-portal-wrapper"> 

    <!-- default theme templates --> 
    <theme href="theme.html" /> 
    <!-- Add your default transform rules here --> 
    <rules css:if-content="body.section-contact"> 
     <!-- Theme template is already setup on top of this file --> 
     <!-- Add section specific rules here --> 
     <drop css:theme="#sidebar" /> 
    </rules> 
</rules> 
</rules> 

這些規則是儘可能接近通過重氮/ plone.app.theming所需的設置,應該只需要輕微的調整空間(namespace校正和搜索/替換爲append/after例如) - 我只是這個例子已經被移植到Plone4.1/diazo,沒有任何重大缺陷。

+1

嗨,我試圖從xdv設置中刪除主題文件設置,並將其放入我的rules.xml中。'''但它只適用於第二個。如果我去其他任何地方,我根本沒有任何變換:( – simahawk 2011-05-04 16:43:08