我使用的是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" />在设置中指定默认主题(即使它已经注册到@@xdv- rules.xml ),但没有成功。
这里我漏掉了什么?
提前谢谢你,SimO
发布于 2011-05-05 10:12:19
首先,我会考虑转向plone.app.theming。据我所知,升级/更改相当微不足道(http://pypi.python.org/pypi/plone.app.theming#migrating-from-collective-xdv),p.a.theming提供了在collective.xdv下开发的所有最新和最棒的功能。
其次,我要参考这篇文档:
听起来您只需要首先配置默认主题,然后添加一个条件,以便在条件匹配时更改相应的部分。附加的匹配主题不应该影响“默认”(第一个匹配的)主题。
发布于 2011-05-04 20:15:22
我不确定我是否完全理解了您的设置和您的特定问题,所以我只发布了一个工作示例。注意:我们没有在xdv控制面板中使用default theme值,因为它无论如何都会在plone.app.theming中过时。它似乎还直接干扰了在rules.xml中设置主题模板,这可能与您的特定问题/用例相关。
<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升级到Plone4.1/diazo,没有任何重大缺陷。
https://stackoverflow.com/questions/5882468
复制相似问题