Skip navigation
The Foundry Theming Engine for LibreCCM

The Foundry Theming Enine for LibreCCM

Jens Pelzetter

Foundry Documentation

Overview

Overview

Placeholder

This manual

Placeholder

User Manual

About Foundry

Placeholder

Layout templates

Placeholder

CSS files

Placeholder

Templates Tags Reference

fragment-layout

Root element for generating a HTML fragment instead of a complete HTML document.

page-layout

Root element of a template. Generates the <html> root element.

content-item

This tags inserts the HTML representation of the current content item, either as greeting item or normal item.

The HTML representation of a content item is defined using special templates with the contentitem-layout element as root. Usually these templates are located in the templates/content-items folder. Which template is used for a particular content item is defined by the conf/templates.xml file. In this file there is a content-items below the templates element. The association between templates and content items is described by the content-item elements in the content-items element. The content-item has four optional attributes (at least on must be present) which are used to limit the content items for which a template is used. The four attributes are:

oid
Limit the use of the template to a specific content item, identified by its OID (the OID of the master version). Can't be used in combination with the other attributes.
content-section
The name of the content section to which the item belongs. Can be used in combination with the category and content-type attributes.
category
The template is only used for the content item if the item is viewed as item of the category. The category is set as a path contains the names the categories.
content-type
The content-type of the item.
The template system

show-page-title

Outputs the title of the current page. For a content item, this is the title of the content item. For more details please refer to the documentation of the foundry:title function.

See also

show-text

Outputs a static text which is retrieved from the static-texts/global.xml file in the layout file. The key is the content of the element. If at least one of the attributes id, class or with-colorset is present at the attribute, the text is wrapped in a span element.

Attributes

id
class
with-colorset
span

a

Generates a HTML a element. There are some differences to the a element in HTML. First, there two attribute for the URL:

href-property
The name of a property of the current object which contains the URL for the link.
href-static
A static URL.

The third variant for providing an URL is to call the template with a href parameter in the XSL.

Attributes

download

Value for the HTML5 download attribute.

href-property

The name of a property (aka the name of an XML element in the data-tree) containing the URL of the link.

href

A static URL for the link.

href-lang

The language of the target of the link.

rel

The relationship of the linking document with the target document.

title-static

A key which identifies the translated title in lang/global.xml.

title

Static, not translated title of the link.

type

Value for the title attribute of the link.

See also

aside

Generates a HTML5 aside element.

See also

body

Generates the HTML body element.

See also

dd

A definition of term in a definition list.

See also

div

Generates a HTML div element.

See also

divIfNotEmpty

Generates a HTML div element, but only if the content is not empty.

See also

dl

Generates a definition list.

See also

dt

A term in a definition list.

See also

main

Generates a HTML5 main element.

See also

meta

Generates a meta data field in in the head element.

See also

script

Used to include a script (usally a JavaScript). The script is either provided a content of the element or as an external file. Embedded scripts should only be used for small parts of code, like the code for activating jQuery plugins for some elements. Everything which is longer than five or six lines should be put into a external file in the scripts directory of the theme.

Attributes

absolute

If set to true the path in the src is used as it is.

src

The path of the script to include. If the absolute> attribute is not set (or not set to true the path is interpreted relative to the theme directory. For example the path of a script included using

                <script type="text/javascript" src="scripts/example.js"/>
                

in the a theme named my-theme at the server http://www.example.org is altered to the absolute path http://www.example.org/themes/published-themedir/itb/scripts/example.js. If the absolute attribute is set to true the path is not altered. One usecase for an absolute path is to load an script from a content delivery network.

type

The type of the script. Usally this is text/javascript. If the attribute is not set in the layout template, it is automatically set to text/javascript.

See also

section

Generates a HTML5 section element.

See also

span

Generates a span element.

See also

title

Generates the title in the HTML head. The other elements are allowed in the <title> tag:

  • show-text
  • show-page-title

See also

load-css-files

Invokes the foundry CSS loader. The CSS loader will parse the file conf/css-files.xml to determine for which CSS an <link> element should be added to the HTML output. For a full explanation please refer to the CSS files section.

Developer Manual

The structure of Foundry

Placeholder

Coding style

This document describes the coding conventions for the Foundry theming engine.

Naming

The naming rules described here apply to all names: Names of layout elements, XSL template names, EXSLT functions, files, ids and classes (in the class attribute).

Use the dash "-" to separate parts of a name instead of camel case or the underscore. For example: get-setting instead of getSetting or set_setting.

Names should be lowercase.

Namespace declarations

In the XSL files, XML namespaces are only defined at the <xsl:stylesheet> element. The XSL namespace is the first one is declared first. The other namespace follow in alphabetic order (ordered by their prefix).

Indention, line length and formating

Indention is done using spaces. Indention depth is four (4) spaces per level.

Try to keep the line length below 100 characters per line. Because of some restrictions of XML this will be possible in every case.

Insert a line break after each attribute of an XML element. The first attribute is on the same line as the element. For example write

<xsl:param name=example-param"
           select="'example'"/>
        

instead of

<xsl:param name=example-param" select="'example'"/>
        

The documentation system of Foundry

Placeholder

XSL Templates and Function references

The version of Foundry. Kept in sync with the version of CCM, so the first version was be 2.2.3. The path the to theme file. This path is used at several points to load files which are part of the theme, like CSS files, images and fonts. The context prefix in which CCM is installed. If CCM is installed into the ROOT context of the servlet container, this variable will be empty. The path on which the CCM dispatcher Servlet is mounted. Usually this is CCM This variables stores the XML created by CCM for later access. This variables stores the XML definition of the Foundry documentation. Activate double click protection on buttons? Activate double click protection on links? The language to use as negotiated by CCM. The languages supported by this theme. They are configured in conf/global.xml using the <supported-languages> element. Example for german and english: <?xml version="1.0"?> <foundry:configuration> … <supported-languages default="de"> <language locale=de"> <language locale=en"> </supported-languages> … </foundry:configuration> The language to use by theming engine for static texts etc. The language is determined as follows: If the negotiated language is also in the supported-languages If not the language which set by the default attribute of the <supported-languages> is used, but only if this language is in the supported languages. Otherwise the first of the supported languages is used. The name of the user agent (browser) which is used to access CCM. Helper functions for generating the name of the colorset class. Helper functions for retrieving the name of the content type of the current content item from the result tree XML. Helper template for processing arrows/links for sorting items. Helper template for processing additional attributes in the data tree XML. They copied literally from the XML the HTML. The name of the template file to process. This template is the entry point for the template parser. Helper template for setting the id and class attributes on a HTML element. A helper template for generating the <link rel="stylesheet" href="..."/> elements for loading the CSS files. The name of the CSS file to load The media for which the file should be loaded. If no set, the CSS file is used for all media types.

Function foundry:boolean

A helper function for evaluating certain string values to boolean. This function has two purposes. First it simplifies some expressions. for example if you have a template tag with a attribute containing a (pseudo) boolean value (attribute values are always treated as strings) you would have to write something like:

                ...
                <xsl:if test="./@attr = 'true'">
                ...
                </xsl:if>
                ...
            

Using foundry:boolean this can be simplified to

                ...
                <xsl:if test="foundry:boolean(./@attr)">
                ...
                </xsl:if>
                ...
            

The more important purpose is to make the usage of boolean values more user friendly, especially in the templates. Using foundry:boolean no only true is evaluated to boolean true. A number of other strings is also evaluated to true:

  • true
  • TRUE
  • yes
  • YES
  • t
  • T
  • y
  • Y

All other values are evaluated to false.

Parameters

Name Mandatory Type Description
value yes string

The value to evaluate.

Result

Result type

boolean

Description

The evaluated boolean value.

Function foundry:message

A helper function used by the other message functions like foundry:message-warn. Concatenates the message level with the message.

This function should not be used directly. Use the other message functions instead.

Parameters

Name Mandatory Type Description
level yes string message yes string

Result

Result type

xs:string

Description

A message string of the form [Foundry $level] $message with $level and $message replaced by the values of the parameters.

Function foundry:message-info

Helper function to generate an info message. This function be used together with <xsl:message> to output a message in the CCM log. Example:

                ...
                <xsl:message>
                    <xsl:message select="foundry:message-info('Hello from Foundry')" />
                </xsl:message>
            

Parameters

Name Mandatory Type Description
message yes string

Result

Result type

xs:string

Description

A message string of the form [Foundry INFO] $message with $message replaced by the value of the parameter.

Function foundry:message-warn

Helper function to generate an info message. This function be used together with <xsl:message> to output a message in the CCM log warning the administrator about some things in the theme, for example a missing configuration file. Example:

                ...
                <xsl:message>
                    <xsl:message select="foundry:message-info('Something is strange...')" />
                </xsl:message>
            

Parameters

Name Mandatory Type Description
message yes any

Result

Result type

xs:string

Description

A message string of the form [Foundry WARNING] $message with $message replaced by the value of the parameter.

Function foundry:message-error

Helper function to generate an info message. This function be used together with <xsl:message> to output a message in the CCM log when something goes wrong in the theme, for example when a layout file has a wrong structure. Example:

                ...
                <xsl:message>
                    <xsl:message select="foundry:message-info('Some error has occurred...')" />
                </xsl:message>
                ...
            

Parameters

Name Mandatory Type Description
message yes any

Result

Result type

xs:string

Description

A message string of the form [Foundry ERROR] $message with $message replaced by the value of the parameter.

Function foundry:get-attribute-value

A helper function for retrieving an attribute value from an element. If the attribute is set on the current element the value of the attribute is used as result. If the attribute is not set the default-value is used. This method is used by several layout tags with optional attributes. A common use pattern looks like this:

                <xsl:template match="example">
                    <xsl:variable name="width" 
                select="foundry:get-attribute-value(current(), 'width', '640')" />
                    <xsl:variable name="height" 
                select="foundry:get-attribute-value(current(), 'height', '480')" />
                /<xsl:template>
            

In this example, the element example has two optional attributes: with and height. If the attribute is set in processed XML, the value set there is used. Otherwise the default value (640 respectively 480) is used. Without this function a code block like the one in the xsl:choose block of this function would be necessary for each of the variables.

Parameters

Name Mandatory Type Description
node any attribute-name any default-value any

Result

Result type

any

Description

The value of the attribute if it is set on the current element, the default-value otherwise.

Function foundry:get-setting

Convenient function for calling foundry:get-setting with only the module name and setting name.

Parameters

Name Mandatory Type Description
module yes string

The module of the settings. May be an empty string ('').

setting yes string

The name of the setting to retrieve.

Result

Result type

string

Description

The value of the setting.

Function foundry:get-setting

Convenient function for calling foundry:get-setting with only the module name, the setting name and an default value.

Parameters

Name Mandatory Type Description
module yes string

The module of the settings. May be an empty string ('').

setting yes string

The name of the setting to retrieve.

default yes string

A default value which is used when the setting is not configured.

Result

Result type

string

Description

The value of the setting or the default value if the setting is not configured.

The module of the settings. At the moment this corresponds to the name of the file in the conf directory. The empty string as value corresponds to the global.xml file. The name of the setting to retrieve. The value to use if there is no entry for the setting in the settings file. A node from the layout template which overrides the value from the configuration. The value of the requested setting or if no value has been set the provided default value. If no default value has been provided the result is an empty string. This function retrieves the value of a setting from the theme configuration. For more informations about the configuration system of Foundry please refer to the configuration section of the Foundry documentation.

Function foundry:get-static-text

Retrieves at static text. For more informations about static texts in Foundry please refer to the static texts section in the Foundry documentation.

Parameters

Name Mandatory Type Description
module yes string

he module of the settings. At the moment this corresponds to the name of the file in the texts directory. The empty string as value corresponds to the global.xml file.

id yes string lang no string

The language to retrieve. Normally there is no need to set this parameter because it is determined automatically.

Result

Result type

string

Description

The requested static text. If there is no value for the requested static text in the module provided by the module parameter the value depends if the debug mode is enabled or not. If the debug mode is not not enabled the result is an empty string. If the debug mode is enabled, a identifier of the text (the value of the id parameter) is displayed. If you point the mouse pointer of the placeholder, the complete path of the text is shown as hovering box.

Function foundry:debug-enabled

A helper function to determine if the debug mode should be enabled. The debug mode of foundry is automatically enabled if the theme is viewed as development theme.

Result

Result type

any

Description

true if the debug mode if active, false otherwise.

Function foundry:read-current-category

Result

Result type

any

Description

The path of the current category.