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.

See also

page-layout

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

See also

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

See also

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.

See also

The entry point for creating Foundry documentation.

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. The value to evaluate. A helper function for evaluating certain string values to boolean. This function has two 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: ... ... ... Using foundry:boolean this can be simplified to ... ... ... 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. The level of the message, indicating its severity The message text. A helper function used by the other message functions like foundry:message-warn. Concats the message level with the message. This function should not be used directly. Use the other message functions instead. #foundry-message-info #foundry-message-warn #foundry-message-error The message text. 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> #foundry-message-warn #foundry-message-error The message text. 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> #foundry-message-info #foundry-message-error The message text. 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> #foundry-message-info #foundry-message-warn The node from which the value of the attribute is read. The attribute to check for. The default value if the attribute is not set. The value of the attribute if it is set on the current element, the default-value otherwise. 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. 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. 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. The name of the text to retrieve. The language to retrieve. Normally there is no need to set this parameter because it is determined automatically. 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. Retrieves at static text. For more informations about static texts in Foundry please refer to the static texts section in the Foundry documentation. true if the debug mode if active, false otherwise. 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. Helper template for processing additional attributes. This are copied from the result tree XML created by CCM to the HTML output generated by Foundry without any further processing. The entry point for creating Foundry documentation.