Start page
Start page

Start page / Template development / Template syntax / Instructions / $CMS_RENDER

$CMS_RENDER(...)$Available from FirstSpirit Version 3.1

Using $CMS_RENDER(...)$

The instruction $CMS_RENDER(...)$ is used within a template:

  • to integrate the content of a format template
  • to invoke a script

Syntax of $CMS_RENDER(...)$

The following syntax must be adhered to when using $CMS_RENDER(...)$:

$CMS_RENDER(template:"IDENTIFIER",
IDENTIFIER_1:VALUE_1,
IDENTIFIER_2:VALUE_2,
...
IDENTIFIER_N:VALUE_N
)$

or

$CMS_RENDER(script:"IDENTIFIER",
IDENTIFIER_1:VALUE_1,
IDENTIFIER_2:VALUE_2,
...
IDENTIFIER_N:VALUE_N
)$
Important All parameters, apart from template and script are optional.

Within a $CMS_RENDER(...)$ statement, multiple parameters are passed comma separated,e.g.:

$CMS_RENDER(template:"tooltip", infoLayer:st_infoLayer)$

Parameters of $CMS_RENDER(...)$

$CMS_RENDER(...)$ has the following parameters:

Integrating the content of a format template (template)

The template parameter defines the format template which is to be integrated in the current position of a template.

$CMS_RENDER(template:"IDENTIFIER",...)$

The IDENTIFIER is the abbreviation of the format template to be integrated.

As a default the template version of the currently generated presentation channel is always used.

Script invocations within a template (script)

Scripts which were created in the project as script type "template" (see area Scripting) can be used from a page or section template and also from links using the instruction $CMS_RENDER(...)$:

$CMS_RENDER(script:"IDENTIFIER",...)$

The IDENTIFIER is the reference name of the script to be addressed.

As a default the template version of the currently generated presentation channel is always used.

User-specified parameters

The instruction can be used to pass any number of user-specific parameters to the format template or the script.

The identifier of a parameter is separated from the value by a colon (:).

Each user-specified parameter is in turn separated by a comma (,)

...,IDENTIFIER_1:"VALUE_1",IDENTIFIER_2:OBJECT_2, ...,IDENTIFIER_N:"VALUE_N"

Either an object or a variable or a text value (is enclosed in double inverted commas) can be passed as a value.

The value is then available in the format template or in the script under the IDENTIFIER e.g.

$-- Page template: --$
$CMS_RENDER(template:"Output",variable:"VALUE")$

$-- Format template "Output": --$
Output: $CMS_VALUE(variable)$

or

$-- Page template: --$
$CMS_RENDER(script:"ScriptOutput",variable:"VALUE")$

$-- Script "ScriptOutput": --$
//!BeanShell
result.setValue(gc.getVariableValue("variable"));
Important The following identifiers should not be used for user-specified parameters: template, script or version!

Output of lists

Available from FirstSpirit Version 3.1 In the FirstSpirit Version 3.1, $CMS_RENDER(...)$ could be used to also output the contents of Lists. This is no longer possible in FirstSpirit Version 4.0 with $CMS_RENDER(...)$.

Available from FirstSpirit Version 4.0 Iterative outputs, e.g. of lists can be completely realised using $CMS_FOR(...)$ or using a combination of $CMS_RENDER(...)$ and $CMS_FOR(...)$.

Example of a list output in 3.1:

$-- Page template: --$
$CMS_RENDER(template:"listsOutput",renderVariable:list)$

$-- Format template "listsOutput": --$
<pre>
$CMS_VALUE(renderValue)$
</pre>

Example in 4.0 syntax ($CMS_FOR(...)$ in combination with $CMS_RENDER(...)$):

$-- Page template: --$
$CMS_FOR(_w, list)$
$CMS_RENDER(template:"listsOutput",renderValue:_w)$
$CMS_END_FOR$

$-- Format template "listsOutput": --$
<pre>
$CMS_VALUE(renderValue)$
</pre>

Examples of $CMS_RENDER(...)$

Several examples of use of the instruction within templates are shown in the following. The examples are intended to clearly show the specific effect of the instruction and provide help for the template developer when creating their own templates.

Important The examples displayed here must be adjusted for use within a project! For example, variable names must be changed to the specific variable names of the project in which the instruction is to be used.

1st Example: Conditional output with the help of a format template

Code example:

$-- Page template: --$
$CMS_RENDER(template:"DefaultLayoutTemplate",style:true,value:"Value")$

$-- Format template "DefaultLayoutTemplate": --$
$CMS_IF(style)$
<b>$CMS_VALUE(value)$</b>
$CMS_ELSE$
<i>$CMS_VALUE(value)$</i>
$CMS_END_IF$

Description:

Depending on the value of the transfer parameter style the value given in value is output as formatted output. If the value of style is set to true the value is output in bold characters, if the value is set to false the value is output in italic.

Output:

<b>Value</b>

2nd Example: Output in conjunction with a script

Code example:

$-- Page template: --$
$CMS_RENDER(script:"ScriptOutput",value:"Value")$

$-- Script "ScriptOutput": --$
//!BeanShell
result.setValue(gc.getVariableValue("value"));

Description:

The script ScriptOutput outputs the value of the transfer parameter value.

Output:

Value 

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2014-07-21