Current

This document is valid for the current version of Plone.

Diazo theme snippets

by Matt Yoder last modified Jan 06, 2012 12:33 PM
Collects commonly-used rules snippets for use in Diazo themes.

These snippets contain Diazo and XSL rules for common modifications to Plone's markup. You can use them in the rules.xml file of your Diazo theme.

Three-column layout

<!-- Switch to a three-column layout. -->
<xsl:template match="@class[contains(., ':')]">
  <xsl:attribute name="class">
    <xsl:value-of select="str:replace(str:replace(str:replace(., '1:4', '1:3'), '1:2', '1:3'), '3:4','2:3')"/>
  </xsl:attribute>
</xsl:template>

Fix FBML tag namespace

<!-- The HTMLParser strips the fb namespace from FBML tags, so we need to replace it. -->
<!-- See: http://stackoverflow.com/questions/5578910/local-name-support-in-collective-xdv -->
<xsl:template match="activity|add-profile-tab|bookmark|comments|friendpile|like|like-box|live-stream|login-button|pronoun|recommendations|serverFbml|profile-pic|user-status">
  <xsl:element name="fb:{local-name()}" xmlns:fb="http://www.facebook.com/2008/fbml">
    <xsl:apply-templates select="@*|node()"/>
  </xsl:element>
</xsl:template>

Set class attributes based on position in content

The code snippet below takes portlets from the content and puts them in a wrapper div class="col1" or class="col2" alternately.

      <xsl:for-each css:select="#portal-column-one div.portletWrapper">
        <xsl:element name="div">
          <xsl:attribute name="class">
            <xsl:text>col</xsl:text>
            <xsl:value-of select="2 - (position() mod 2)" />
          </xsl:attribute>
           <!-- original div.portletWrapper goes here -->
           <xsl:copy-of select="." />
        </xsl:element>
      </xsl:for-each>

 


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.