Template System 4.0

From Cloudrexx Development Wiki
Jump to: navigation, search

Note: This documentation refers to version 4 or older. For newer versions of Cloudrexx, please refer to Template System.

Contrexx uses the PEAR HTML Sigma Template templating system.

Contrexx implements (since version 3) a wrapper to the PEAR HTML Sigma Template engine that enables Customizings. You are advised to use the Contrexx wrapper (\Cx\Core\Html\Sigma) to make full usage of the Customizings functionality. The wrapper provides the whole function-set as provided by the underlying PEAR HTML Sigma Template engine.

The documentation of PEAR HTML Sigma Template can be found at http://pear.php.net/package/HTML_Template_Sigma/docs.

Placeholder format

Contrexx uses a slightly differtent placeholder format than what PEAR HTML Sigma Template uses. In general Contrexx uses the following format (notation as regexp):


A few examples follow:


For the naming conventions that should be applied to placeholders, please refer to the related article Naming conventions.

Note for developers and webdesigners

It is important to know that the above placeholder format is due to historical reasons and is only used in the view (GUI) of Contrexx. Internally (in the database and file system), Contrexx uses the placeholder format of PEAR HTML Sigma Template. Which is as follows:


Therefore, when interacting directly with the database, please be aware of that the placeholders do not use the same format as the ones that are getting displayed in the backend and Frontend-Editing of Contrexx. Same applies to any data that is stored in the file system. Especially if you intent to build a new or modify an existing webdesign-template using your favorite text-editor, remember to use the appropriate format ({[0-9A-Za-z_-]+}) when inserting placeholders.

Interface text - language variables

As Contrexx is by design a multilingual system, each interface text is being implemented by a so called "language placeholder" or "language variable". Those placeholders use a special naming convention that is described in the article Text-Variable.

Template Block format

See article Naming Conventions (Template blocks).


Instead of instantiating a PEAR HTML Sigma Template object, you would simply instantiate a \Cx\Core\Html\Sigma object. You can then use all functions provided by PEAR HTML Sigma Template on the newly created instance of \Cx\Core\Html\Sigma.

// instantiate a new template object
$objTemplate = new \Cx\Core\Html\Sigma('path/to/template/file.html');

// parse a template variable
$objTemplate->setvariable('TXT_FOO', 'bar');

// output parsed template
echo $objTemplate->get();

Storage location of template files

Type Location
Frontend Application page in content manager
Backend template/
Generic lib/