我对不同的网站部分有不同的主题HTML文件。如果页面是首页或某个子部分,则会有一些主要布局差异。collective.xdv和多个主题文件
至于我看到的默认行为只是为了有一个HTML文件:
http://pypi.python.org/pypi/collective.xdv#usage
什么是使用多个主题文件,轻微的规则变化和collective.xdv最好的策略是什么?
Plone 4.1b。
我对不同的网站部分有不同的主题HTML文件。如果页面是首页或某个子部分,则会有一些主要布局差异。collective.xdv和多个主题文件
至于我看到的默认行为只是为了有一个HTML文件:
http://pypi.python.org/pypi/collective.xdv#usage
什么是使用多个主题文件,轻微的规则变化和collective.xdv最好的策略是什么?
Plone 4.1b。
我们通常只是使用纯xdv并使用rules.xml
(或任何您想调用它的文件)来设置主题模板,并将collective.xdv controlpanel中的相应属性留空。嵌套规则在分配不同模板时会给你一些灵活性:
<?xml version="1.0" encoding="UTF-8"?>
<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-path="/section/subsection/somefolder" href="somefolder.html" />
...
<rules css:if-content="#visual-portal-wrapper">
<!-- The default theme -->
<theme href="theme.html" />
<rules css:if-content="body.section-somefolder">
<!-- Secific rules for somefolder go here -->
...
</rules>
</rules>
我的个人Plone站点对不同的部件使用不同的主题和规则文件。
您是否在使用XDV控制面板/@@ xdv-settings?
在主题模板和规则文件领域,我把我默认(即最常用的)文件。
在替代主题文本框中,您可以根据给定的路径提供替代主题和规则文件。
格式为路径主题规则。
这里是从我的网站的配置一些例子:。
如您所见,您可以使用正则表达式语法来匹配路径。
第一行是样式化登录和注销页面。 第二款造型仅我的博客的登陆页面(henche $) 第三款我的软件页面。
工程就像一个魅力。
您应该使用备用主题设置来在url匹配特定正则表达式时定义备用布局。
例如,我们有一个名为“Plone”的Plone站点,可通过url localhost:8080/Plone进行访问。为了提供主页不同的布局,我们可以定义在注册表中的以下(或Plone的控制面板中TTW> XDV设置部分):
<record field="alternate_themes" interface="collective.xdv.interfaces.ITransformSettings" name="collective.xdv.interfaces.ITransformSettings.alternate_themes">
<field type="plone.registry.field.List">
<description>Define alternate themes and rules files depending on a given path. Should be of a form 'path theme rules' (or 'path rules' with xdv 0.4), where path may use a regular expression syntax, theme is a file path or URL to the theme template and rule is a file path to the rules file.</description>
<required>False</required>
<title>Alternate themes</title>
<value_type type="plone.registry.field.TextLine">
<title>Theme</title>
</value_type>
</field>
<value>
<element>^.*/Plone(/)?$ python://my.xdvtheme/templates/alternative/index.html python://my.xdvtheme/rules/alternative/index-rules.xml</element>
</value>
</record>
这种方式,主页将使用替代布局,而所有其他网页将使用主题模板和规则模板
指定的主要布局您可以根据您的网站的不同部分提供多个定义。
这是推荐的方法。在plone.app.theming中,“替代主题”设置(它早于规则文件中的多个主题)已被删除。 – 2011-04-13 11:16:28
这些建议很有用,但我不知道collective.xdv(现在)是否支持“if-path”规则。 – Vito 2011-04-12 19:39:59