Start page / Templates (basics) / Composition of templates / Format templates / Output

Output of formatted texts

Apart from the Properties tab, further tabs are displayed for each template set of the project.

The screen form for each template set consists of a pull-down list for the output of a Conversion rule and an input area for the template definition.

The template developer must define the output for each template set of a format template in the “Templates” area so that the formatted contents of the DOM input component are visible in the respective template set.

For information on the icons of the toolbar, please refer to page Composition of templates, paragraph “General functions”.

#content system object

The template developer can use the #content system object for the output of contents from a DOM input component. The content of the input component is obtained via the #content system object and is output in the relevant template set via the Instruction $CMS_VALUE(...)$ in the template area of the format template.

The content can be very different depending on the type of format template involved. For the HTML template set it could, for example, be editorial contents in the form of pure text or text and HTML tags or HTML tags only (special case: “LineBreak”).

Important The selected conversion rule will only be applied for the output of CMS_INPUT_DOM or CMS_INPUT_DOMTABLE via the system object #content , for example via $CMS_VALUE(#content)$. But not in the case of calling $CMS_RENDER(...)$.

Example: "Standard" paragraph format (HTML template set)

DOM Editor

The editor enters a paragraph within the DOM Editor which is formatted as “Standard” paragraph (abbreviation: “p”) (see Figure: “DOM Editor”). The following is defined in the template area of the HTML template set for the “Standard” section format template:

<p>$CMS_VALUE(#content)$</p>

The #content object is now used to read out the content of the input content and it is formatted for the “Standard” section format template via a <p> tag (as default setting for this format template). The HTML output is then as follows:

Format templates DOM HTML 1

Example: "LineBreak" format template (HTML template set)

 

Apart from the standard section format there are also format templates which do not output editorial texts but instead output HTML tags only. Such a special case is, for example, the format template for the “LineBreak” (abbreviation: “br”). This format template is not explicitly selected by the editor but instead is always used if the key combination Shift+Enter is used within the DOM input component:

The following is defined in the template area of the HTML template set for the “LineBreak” format template:

<br>

The HTML output (based on the example given above) is then as follows:

Format templates DOM HTML 2

Example: nested format template (HTML template set)

Nested evaluations are of course also possible. For example, if the editor enters the following text:

The inner-lying format templates “LineBreak”:

<br>

and “Bold” are evaluated first:

<b>$CMS_VALUE(#content)$</b>

Then the surrounding section format template “Standard”:

<p>$CMS_VALUE(#content)$</p>

This means the #content object of “Standard” affects the content of the whole section, i.e. including the content of the #content object of “Bold” (“This is a text.”) and the tag <br> of the “LineBreak” format template.

The HTML output (based on the example given above) is then as follows:

Example: Lists and tables (HTML template set)

Lists and tables created by using CMS_INPUT_DOM can be enclosed in the output by tags which derive from a format template.
If this not desired, the method .normalize can be used to suppress the enclosing tags.

© 2005 - 2024 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2024.7 | Data privacy