themesplonexdv

collective.xdv and multiple theme files


I am having different theme HTML files for different site sections. There are some major layout differences depending if the page is the front page, or a certain subsection.

As far as I see the default behavior is just to have one HTML file:

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

What would be the best strategy to use multiple theme files, slight rule variations and collective.xdv?

Plone 4.1b.


Solution

  • We usually just utilize plain xdv and use the rules.xml (or whatever you want to call it) file to setup the theme templates leaving the corresponding properties in the collective.xdv controlpanel empty. Nesting rules gives you quite some fexibility when asigning different templates:

    <?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>