我有不同的主题HTML文件为不同的网站部分。根据页面是首页还是某个子页面,存在一些主要的布局差异。
据我所知,默认行为是只有一个HTML文件:
http://pypi.python.org/pypi/collective.xdv#usage
使用多个主题文件、微小的规则变化和collective.xdv的最佳策略是什么?
Plone 4.1b。
发布于 2011-04-13 02:15:21
我们通常只使用普通的xdv并使用rules.xml (或者你想叫它的任何东西)文件来设置主题模板,在collective.xdv控制面板中保留相应的属性为空。嵌套规则为您在设计不同模板时提供了相当大的灵活性:
<?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>发布于 2011-04-13 16:46:15
当url与特定的正则表达式匹配时,应使用Alternate Themes设置来定义替代布局。
例如,我们有一个名为" Plone“的Plone站点,可通过url localhost:8080/Plone进行访问。要为主页提供不同的布局,我们可以在注册表中定义以下内容(或Plone控制面板> XDV设置部分中的TTW ):
<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>这样,主页将使用备用布局,而所有其他页面将使用在主题模板和Rules模板中指定的主布局
您可以根据站点的不同部分提供多个定义。
发布于 2011-04-13 16:11:15
我的个人Plone站点为不同的部分使用不同的主题和规则文件。
您是否正在使用/@@xdv-settings的XDV控制面板
在主题模板和规则文件字段中,我放置了我的默认(即最常用)文件。
在Alternate Themes文本框中,您可以根据给定路径提供备用主题和规则文件。
格式为路径主题规则。
下面是我的网站配置中的一些例子:
如您所见,您可以使用正则表达式语法来匹配路径。
第一行用于设置登录和注销页面的样式。第二个用于样式化我的博客的登陆页面(henche The $),第三个用于样式化我的软件页面。
就像一种护身符。
https://stackoverflow.com/questions/5633951
复制相似问题