Skip to main content

Variables

General information

A variable is an abstract container for a value. Variables can be defined within the requirements described below.

Structure of variables

Private variables are designated by a Dollar sign ($) followed by an underscore (_) and the name of the variable. Variable names are case-sensitive.

A valid variable name begins with a letter in upper or lower case followed by additional letters or underscores (a-zA-Z_).

Validity

Private variables are only valid within the template in which they were defined (e.g. PageDesignContent, ItemViewSingleItem, etc.). This means that you can define private variables with identical names in different variables without causing conflicts.

Access

No block is necessary to print the contents of private variables. In the example below, a variable is defined and its content is then printed as a header.

{% $_string = "Some title"; %}

<h1>$_string</h1>

A private variable can only be used within the current template. If a value is assigned to a variable in one template, then this value can only be accessed within this same template.

Global private variables are planned for future versions.

Tip

Arrays: Individual values, i.e. elements, of arrays can only be accessed when template variables are used. Private variables of the type Array currently primarily serve to pass values to functions.

Assignment

Values can only be assigned within blocks and to private variables. The following data types are supported.

Boolean

{% $_iAmTrue = true; %}

{% $_iAmFalse = false; %}

Integer

{% $_foo1 = 123; %}

{% $_foo2 = +123; %}

{% $_foo3 = -5; %}

Float / double

{% $_positive1 = 9.49; %}

{% $_positive2 = +2.5; %}

{% $_negative = -1.38; %}

String

Strings can be enclosed by single or double quotes. The quote used to enclose the string can not be used within the string itself.

{%
	$_string = "Hello world";

	# concat
	$_string .= " Have a nice day!";
%}

Template variables

You can also assign the content of template variables to private variables.

{% $_foo = $ReferrerID; %}

Array

An array can only consist of one dimension. The individual values of an array can be of different data types.

However, only the following data types are permitted:

  • Integer

  • Double

  • String

  • Boolean

The following array consists of the values 127, 9.49 and the string plenty.

{% $_list = [127, 9.49, "plenty"]; %}

NULL

{% $_nothing = NULL; %}

Container

Containers are functions that return the content of container templates.

{% $_selectionHtml = Container_ItemViewManualSelectionList([15342,583]); %}
To top