4

サイト セクションごとに異なるテーマ HTML ファイルを使用しています。ページがフロント ページであるか、特定のサブセクションであるかによって、いくつかの大きなレイアウトの違いがあります。

私が見る限り、デフォルトの動作は HTML ファイルを 1 つだけ持つことです。

http://pypi.python.org/pypi/collective.xdv#usage

複数のテーマ ファイル、わずかなルールのバリエーション、collective.xdv を使用する最善の戦略は何でしょうか?

プレーン 4.1b.

4

3 に答える 3

3

通常は単純な 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-12T18:15:20.580 に答える
1

URL が特定の正規表現と一致する場合は、代替テーマ設定を使用して代替レイアウトを定義する必要があります。

たとえば、「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>

このように、ホームページは代替レイアウトを使用し、他のすべてのページはテーマ テンプレートルール テンプレートで指定されたメイン レイアウトを使用します。

サイトのさまざまなセクションに従って、複数の定義を指定できます。

于 2011-04-13T08:46:14.887 に答える
0

私の個人的な Plone サイトでは、パーツごとに異なるテーマとルール ファイルを使用しています。

/@@xdv-settingsで XDV コントロール パネルを使用していますか?

テーマ テンプレートルール ファイルのフィールドに、デフォルトの(最もよく使用される) ファイルを配置します。

代替テーマテキストボックスでは、特定のパスに応じて代替テーマとルール ファイルを指定できます。

形式はパス テーマ ルールです。

ここに私のウェブサイトの構成からのいくつかの例があります:

  1. .*/login_form|.*logged_out /home/zope/production/theme/theme.html /home/zope/production/theme/login.xml
  2. /media/blog$ /home/zope/production/theme/blog.html /home/zope/production/theme/blog.xml
  3. /media/software /home/zope/production/theme/software.html /home/zope/production/theme/media.xml

ご覧のとおり、正規表現構文を使用してパスを一致させることができます。

最初の行は、ログイン ページとログアウト ページのスタイルを設定するためのものです。2 番目は私のブログのランディング ページ ($ をヘンチ)のみをスタイリングするためのもので、3 番目は私のソフトウェア ページをスタイルするものです。

魅力のように機能します。

于 2011-04-13T08:11:15.270 に答える