Collective.xdv - 定义替代主题打破默认主题的转换
我正在使用 plone 4.0.1 + Collective.xdv 1.0rc11,我需要使用不同的主题。
我正在尝试按照最近的问题/答案中的描述进行操作,但是当我插入一个新主题,条件是我对默认主题根本没有任何转换。以下是我尝试过的一些示例:
<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"/>
都适用于给定部分,但对于门户的其余部分,根本没有转换。
我尝试使用
在rules.xml中指定默认主题(即使它已经注册到@@xdv-settings中),但没有运气。
我在这里缺少什么?
提前致谢, 西姆奥
I'm using plone 4.0.1 + collective.xdv 1.0rc11 and I need to use different themes.
I'm trying to do as described in a recent question/answer but when I insert a new theme with a condition I get no transform at all for the default theme. Here are some examples of what I tried:
<rules css:if-content="body.section-mysection">
<theme href="mysection.html" />
</rules>
this ends in:
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
While these:
<theme href="mysection.html" if-path="/mysection/"/>
<theme href="mysection.html" css:if-content="body.section-mysection"/>
both work for the given section BUT for the rest of the portal there is no transform at all.
I tried to specify also the default theme in the rules.xml (even if it's already registered into @@xdv-settings) with <theme href="index.html" />
but got no luck.
What am I missing here?
Thanks in advance,
SimO
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先,我会考虑转向 plone.app.theming。据我了解,升级/更改相当微不足道(http ://pypi.python.org/pypi/plone.app.theming#migration-from-collective-xdv)和patheming提供了在collective.xdv下开发的所有最新和最好的功能。
其次,我会参考此文档:
听起来您只需要首先配置默认主题,然后添加条件以在条件匹配时更改相应的部分。附加的匹配主题不应影响“默认”(第一个匹配的)主题。
First, I would consider moving on to plone.app.theming. The upgrade/change is fairly trivial as I understand it (http://pypi.python.org/pypi/plone.app.theming#migrating-from-collective-xdv) and p.a.theming provides all the latest and greatest features that were developed under collective.xdv.
Second, I would reference this document:
It sounds like you just need to configure the default theme first, and then add a condition(s) to change the appropriate section when the condition matches. The additional matched theme should not affect the "default" (first matched) theme.
我不确定我是否完全理解您的设置和您的具体问题,所以我只是发布一个工作示例。注意:我们不在 xdv 控制面板中使用
默认主题
值,因为它无论如何都会被plone.app.theming
淘汰。它似乎还直接干扰在 Rules.xml 中设置主题模板,这可能与您的特定问题/用例相关。这些规则尽可能接近 diazo/plone.app.theming 所需的设置,并且只需要进行细微调整(命名空间更正和搜索/替换
append
/after
例如) - 我刚刚将本示例中的站点迁移到 Plone4.1/diazo,没有任何重大缺点。I am not sure if I understand your setup and your specific problem to the full extend, so I just post a working example. Note: we don't use a
default theme
value in the xdv control panel, since it will be obsolete withplone.app.theming
anyway. It also seemed to interfere with setting up theme tempaltes in the rules.xml directly which might be relevant for your specific problem/usecase.These rules are as close as possible to the setup required by diazo/plone.app.theming and should just need minor adjustments (namespace correction and a search/replace for
append
/after
for example) - I just migrated the site this example has been lifted from to Plone4.1/diazo without any major drawbacks.