我正在使用plone 4.0.1 + collective.xdv 1.0rc11,我需要使用不同的主题。
我正在按照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
答案 0 :(得分:2)
首先,我会考虑转向plone.app.theming。升级/更改非常简单,因为我理解它(http://pypi.python.org/pypi/plone.app.theming#migrating-from-collective-xdv)和p.a.theming提供了在collective.xdv下开发的所有最新和最好的功能。
其次,我会参考这个文件:
听起来你只需要配置默认主题 first ,然后在条件匹配时添加一个条件来更改相应的部分。附加匹配的主题不应影响“默认”(第一个匹配的)主题。
答案 1 :(得分: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>
这些规则尽可能接近diazo / plone.app.theming所需的设置,并且应该只需要进行微调(名称空间更正和append
/ after
的搜索/替换) - 我刚刚迁移了这个例子,这个例子已经从Plone4.1 / diazo迁移到了没有任何重大缺点。