Template-Engine-Referenz

Variablen und Konstanten

Variablen-Ausgabe {$VarName}

Using the template engine, you can easily output the contents of variables in the template code.
You can use diffrent types of variables - simple variables containing strings, integers or bools as well as arrays.

{$VarName}
{$ArrayName['ArrayKey']}

Super-globale Variablen {$GLOBALS} {$_SESSION} {$_COOKIE} {$_GET} {$_POST}

You can access the PHP-superglobal variables by their respective names

{$GLOBALS['Key']}
{$_SESSION['Key']['Subkey']}
{$_COOKIE['Key']}
{$_GET['Key']['Subkey']['Subkey']}
{$_POST['Key']}

Globals-Variable {$GLOBALS['key']}

There are some useful GLOBALS, predefined by the cms.
To get its values, call the varaible $GLOBALS, possibly folowed by a key.

{$GLOBALS['Key']}

Predefined keys

PageUID(int)ID of the current page
PageAlias(string)Alias (filename wiothout suffix) of the current page
PageTail(string)Part of the path, after alias.html
CustomergroupUID(int)ID of current user-group
LanguageUID(int)ID of current language
LanguageCode(string)ISO2-code of current language
DefaultLanguageUID(int) ID of the default language
DefaultLanguageCode(string)ISO2-code of the default language

Cookie-Variable {$_COOKIE['key']}

To get its values, call the varaible $_COOKIE, possibly folowed by a key.
There are some useful cookie-variables, predefined by the cms.

{$_COOKIE['Key']}

Predefined keys

cookiebar(int)State of the cookie-confirmation
viewport(string)pixel width and height of the viewport - separated by comma

Template-Variablen {$Template['VarName']} {$GLOBALS['Template']['VarName']}

Some Website-templates use template-variables for different purposes.
You usually can set or change these variables in the basic-module of the cms-administration.
Common applications are the hotline, slogan or social media links in the web design, as well as enabling or disabling components or boxes on the website.

// Available only in page-template
{$Template['VarName']}
// Available in page-template and other templates
{$GLOBALS['Template']['VarName']}

Dummy-Variablen {$Dummy}

Sometimes you will need a value generated with the template-engine but have no suitable variable.
In this case you can simply use own variable-names. As an example we could use {$Dummy}.
You can fill this variable with content, using the set-function an then modify it with other functions

{$Dummy|set:value=ABC123|[function:attrib=value|[function:attrib=value]}

Konstanten-Ausgabe {CONSTANT}

It is possible to output the values of defined constants.
A common application is the use for output language constants.

{CONSTANT_NAME}
{LANG_CMM_MORE}

Funktionen anwenden |functionname

We can extensivly manipulate the values of variables and constants for the output, without making changes to the data in the database.
To accieve this goal we add the required function and params after the variable name.
There are three types of separators.
The pipe "|" separates the variable from the function name.
The colon ":" separates the function name an the attributes, as well as the different attributes.
And finally the "=" separates the attribute names from the values.

{$VarName|function:Attrib=Value:Attrib=Value:...}

If the Colon ":" should be used in a value, just escape it "\:"

Verkettung / Chaining |functionname|functionname

Sometimes it is required to use multiple functions. Therefor you can chain functions using the pipe "|" as separator.
The functions are proccessed in the order you defined them in the string.
For example you could take a variable-value, cut its length, then convert the first letter in uppercase and finally wrap into an HTML container.

{$VarName|Function:Attrib=Value:Attrib=Value:...|Function:Attrib=Value:...}

Wert zuweisen |set

If you need to set or change the value of a variable, the mostly simple way is to use the "set" function.
{$VarName|set:[value=string]:[variable=$Varname]}

Attributes

value(string) The new value of the variable
value(variable) The variable to get the contents from (Globals allowed)

Wert in Variable updaten |update

Override the original variable-value with the manipulated value.
Works only for variables in the current input array.
You can access the super-global $GLOBAL, if needed in a global context, but be aweare of the proccess order inside the template (if and foreach are proccesed first).

{$VarName|update}
{$VarName[item][item]|update}
{$GLOBALS[item]|update}
{$VarName|set:value=ABC|update}

Ausgabe leeren |clear |hide

Clear the current value to prevent/hide it from output (only in this variable call).

{$VarName|clear}
{$VarName|hide}

Variable/Konstante debuggen |debug |vardump |var_dump

You can get more information about the content of a variable, by using one of the following functions.
This will show the content of the variable using the php function var_dump().

{$VarName|debug}
{$VarName|vardump}
{$VarName|var_dump}

Template-Subparts

Template-Parts definieren {subpart}

Some templates use subparts, to declare partials for different purposes or areas within the same template-file.

{subpart:SubpartName1}
  HTML-Content
{/subpart}
{subpart:SubpartName2}
  HTML-Content
{/subpart}

Bedingungen

IF-Bedingung {if} {else if} {else} {/if}

Sometimes there is a need to make a decision whether a content or a part of the template should be show. For this purpose we use conditions.
The syntax is neer to the PHP-sytax. You can build conditions with multiple steps, and even nest conditions.

{if CONDITION}
  Output then
{else if CONDITION}
  Output else if
  {if CONDITION}
    Output then
  {/if}
{elseif CONDITION} (alternative w/o space between else and if)
  Output elseif
{else}
  Output else
{/if}

The condition-statement in "if" and "else if" can be used like the condition-statements in PHP.
It supports combinations of comparisions with ||, && and braces. You can even use PHP-functions in conditions.

Exapmles for conditions

{if $VarName [==,<,>,<=,>=,!=] 'String'}
{if $VarName [==,<,>,<=,>=,!=] $VarName2}
{if $VarName [==,<,>,<=,>=,!=] $_GET,$_POST,$_COOKIE,$GLOBALS[VarName]}
{if strlen($VarName) > 10}
{if CONDITION || CONDITION}
{if (CONDITION && CONDITION) || CONDITOIN}

Examples

{if !empty($VarName) && strlen($VarName) > 10}
  Output goes here, if $VarName is not empty() and has more then 10 chars.
{/if}
 
{if $VarName == 'test'}
  Output goes here, if the value of $VarName is test.
{/if}

Foreach-Schleifen {foreach} {/foreach}

You can create loop-structures in your template, for example to loop through complex arrays like news-items or staff-members or just a single list of values.
In the loops you can use HTML-content, variables, conditions and plugins.

{foreach $Array}
  {$Key} HTML-Output and variables for each loop goes here
{/foreach}
 
OR
 
{foreach $Array as $Item}
  {$Item['Key']} HTML-Output and variables for each loop goes here
{/foreach}

In some cases the loop-variable is not an array. Then you can try to explode it before looping through the array-items.
Just add the explode-statement to the variable with a separator-string as the only attribute.

{foreach $String|explode:separator=,}
  HTML-Output and variables for each loop goes here
{/foreach}

Within the loop you have access to the array-items.
For an associative array you can use the keys as variables, which again can contain an array.

{foreach $Array}
<!-- Associative array: use the keys as variables -->
  {$key} = $Array['key']
<!-- Indexed array: '$value' -->
  {$value} = $Array[0-n]
{/foreach}

Attention! On practical reasons, for indexed arrays with an associative array in the second level, you have to directly use the associative keys as variables within the loop. This is the typical behaviour for listed contents like news, events, staff and so on.

{foreach $items}
<!-- Indexed-Associative array: use the associative keys as variables -->
  {$NewsItemTitle} = $items[n]['NewsItemTitle']
{/foreach}

And finally there are some usefull helper vars in the loop, generated by the template-engine. Is is these two variables, that contain the name of the array-key or ist number on indexed arrays and an incremetor for the loop-count.

{foreach $Array}
<!-- Index - '$i' -->
  {$i} = [n] or [associative-key]
<!-- Incremetor - '$inc' -->
  {$inc} = [0-n]
{/foreach}

Funktionsbedingungen :ifempty :ifnotempty :ifemptystring :ifnotemptystring

You can equip every variable-function with one of these conditions as the first parameter,
to proccess this function only if the condition matches the current value.

ifempty - checks with the PHP-Function empty($Variable)
ifnotempty - checks with the PHP-Function !empty($Variable)
ifemptystring - compares as string $Variable===''
ifemptystring - compares as string $Variable!==''

{$Variable|wrap:ifnotemptystring:before=PrependString}
{$Variable|set:ifempty:value=NewValue}

String-Funktionen

Umbrüche erzeugen |nl |br

You can create linebreaks without making a real line-break in your code.
This is used especially for creating linebreaks in plugin-attributes, because this attribs may not have line-breaks in the code.

{nl} returns \r\n
{br} returns <br>

\r\n in <br> umwandeln |nl2br

For changing code-line breaks into visible HTML-line-breaks we have a function similar to PHP.

{$VarName|nl2br}

\r\n in definierten String umwandeln |nl2x

For changing code-line breaks into a user-defined string there is a special function, too.

{$VarName|nl2x:replace=<break>}

Attributes

replace(string) Replacement

String trimmen |trim |ltrim |rtrim

You can trim your string on start (left), end (right) or start and end (both).
Here are the three required functions.

<!-- both -->
{$VarName|trim:[chars=...]}
<!-- only at the start - left -->
{$VarName|ltrim:[chars=...]}
<!-- only at the end - right -->
{$VarName|rtrim:[chars=...]}

Attributes

chars(string) List of chars to remove

Großbuchstaben |strtoupper |uppercase

We can simply turn all letter-chars of a string into upper-case.

{$VarName|strtoupper}
{$VarName|uppercase}

Kleinbuchstaben |strtolower |lowercase

We can simply turn all letter-chars of a string into lower-case, too.

{$VarName|strtolower}
{$VarName|lowercase}

Erster Buchstabe groß / klein |ucfirst |lcfirst

Finally, it is possible to turn only the first letter-char of a string into upper-case or lower-case.

<!-- first char upper-case -->
{$VarName|ucfirst}
<!-- first char lower-case -->
{$VarName|lcfirst}

String umkehren |strrev |str_rev

With one of the following functions we can reverse a string, like PHP can do.

{$VarName|strrev}
{$VarName|str_rev}

HTML-Steuerzeichen codieren |htmlspecialchars

Turning some chars in HTML-entities: &, <, >, ', "

{$VarName|htmlspecialchars}

HTML-Zeichen codieren |htmlentities

Turning some chars in HTML-entities: ö, ä, ü, ß, &, <, >, ', "

{$VarName|htmlentities}

String auffüllen |strpadleft |strpadright

<!-- pad on left side -->
{$VarName|strpadleft:length=int:string=...}
<!-- pad on right side -->
{$VarName|strpadright:length=int:string=...}

Attributes

length(int) Target string-length
string(string) Char or string to use for padding

Textlänge ermitteln |strlen

With this simple function we can output the string length of a variable-value.

{$VarName|strlen}

HTML-Tags entfernen |striptags |plaintext |rawtext

This tree functions are the same. They are used to remove all HTML-tags from the variable-content.
A common purpose is to remove tags before shortening a string, maybe for short news or events output.

{$VarName|striptags}
{$VarName|plaintext}
{$VarName|rawtext}

Zeichen-Ersatz / Suche-Ersetze |strreplace

Replacing in strings is possible by using the template-function strreplace.
Like its PHP-pendant we need a search and a replace-string.

{$VarName|strreplace:search=string1:replace=string2}

Attributes

search(string) Search-string or ASCII-Number (#123)
replace(string) Replace-string or ASCII-Number (#123)

Container / Wrap |wrap

To wrap a container around a string just use this function.

{$VarName|wrap:before=String:after=String}

Attributes

before(string) String to prepend
after(string) String to append

Prepend / Wrap before |prepend |wrapBefore

To prepend a another string before the current string use one of this two alternative functions.

{$VarName|prepend:string=String}
{$VarName|wrapBefore:string=String} deprecated

Attributes

string(string) String to prepend

Append / Wrap after |append |wrapAfter

To append a another string after the current string use one of this two alternative functions.

{$VarName|append:string=String}
{$VarName|wrapAfter:string=String} deprecated

Attributes

string(string) String to append

String kürzen |cut |cutstring |substr |substring

This four similar functions are for cutting a string todefined length, starting at a position and optinally append something.

{$VarName|cut:length=int:[start=0]:[word=0]:[fill=...]}
{$VarName|cutstring: ...}
{$VarName|substr: ...}
{$VarName|substring: ...}

Attributes

start(int) Start index
length(int) Target length
word(bool) Consider word boundaries
fill(string) Append string

String aufbrechen |wordwrap

Use this function to break long strings into shorter parts to achive make line-breaks possible.

{$VarName|wordwrap:length=int:[separator= ]:[word=0]}

Attributes

length(int) Max number of chars until separator
separator(string) Separator string to place an the cut-position
word(bool) Consider word boundaries

Zahl formatieren |numberformat |number_format

Sometimes we need a function to set an integer oder float to a prefered format.
Use one of these two similar functions.

{$VarName|numberformat:decimals=int:[point=]:[separator=]}
{$VarName|number_format:decimals=int:[point=]:[separator=]}

Attributes

decimals(int) Chars after the decimal separator
point(string) Char to use as decimal separator (Default: .)
separator(string) Char to use as thousands separator (Default: ,)

Ausgabeformat des Strings ändern |format |datatype

Use one of these two identical functions to change the type of the variable-data.
Some of the output formats remove or contain HTML-Tags or create complex structures.

{$VarName|format:type=(formatcode):[decimals=(int)]}
{$VarName|datatype:format(formatcode):[decimals=(int)]} deprecated

Attributes

type / format(string) text, rawtext, autotext, table, link, rawlink, int, integer, float, price, date, time, datetime, datebrtime, datetimerfc, file
decimals(int) Chars after the decimal separator (Default: 2 for price)
point(string) Char to use as decimal separator (Default: .)
separator(string) Char to use as thousands separator (Default: ,)

Array-Funktionen

Array-Länge ermitteln |sizeof |count

Use one of the two following functions to get the number of array-items.

{$VarName|sizeof}
{$VarName|count}

Array imploden |implode

To implode or join an array to a string use this function.
(If you try to use the colon ":" as glue, dont forget to escape it.)

{$VarName|implode:glue=,}

Attributes

glue(string) String or ASCII-Number (#123) to concatenate the array-items

Array exploden |explode

To explode a string to an array use this function.
(If you try to use the colon ":" as separator, dont forget to escape it.)

{$VarName|explode:separator=,}

Attributes

separator(string) String or ASCII-Number (#123), which separates the array-items

Erstes Array-Element entfernen |array_shift

Remove the first Element of an array.

{$VarName|array_shift}

Letztes Array-Element entfernen |array_pop

Remove the last Element of an array.

{$VarName|array_pop}

Erstes Element aus Array zurückgeben |array_get_first

To get the first Element of an array.

{$VarName|array_get_first}

Letztes Element aus Array zurückgeben |array_get_last

To get the last Element of an array.

{$VarName|array_get_last}

Element per Index aus Array zurückgeben |array_get_index

To get the Element of an array with the defined index.

{$VarName|array_get_index:index=Value}

Attributes

index(int/string) Index of the array-item to return

Array verketten |serialize

To serialize an array use this function.

{$VarName|serialize}

Array entketten |unserialize

To unserialize an array use this function.

{$VarName|unserialize}

Array in URL-Parameter umwandeln |arrayurlparams

This function is used to transform an array into a query-string.
Source
$Array = array('Key1'=>'Value1','Key2'=>'Value2');
Target
&Array[Key1]=Value1&Array[Key2]=Value2

{$VarName|arrayurlparams}

Datum-/Zeit-Funktionen

Datum und/oder Zeit erzeugen und ausgeben |date |time |datetime

There are special functions to get and define the format of time or date-values.
All three functions do the same, these are just aliases for a better readable syntax in some cases.
If the variable is empty, the current date and time is used as data.
Alternatively you can set a value for date and/or time by using the timestamp-attribute.
(Make sure to escape the colons ":" when used in attribute-values.)

{$VarName|date:[format=]:[timestamp=]:[wrapDate=]:[wrapTime=]}}

Attributes

format(string) date, time, datetime, datebrtime, datetimerfc, rfcm, timestamp ... or patterns like in PHP-function date()
timestamp(string) timestamp, possible patterns: unix-timestamp, YYYY-MM-DD HH\:II\:SS, YYYY-MM-DD or HH\:II\:SS
wrapDate(string) default <span class="CMM_date">*</span> (only for date, datetime, datebrtime)
wrapTime(string) default <span class="CMM_time">*</span> (only for time, datetime, datebrtime)

Example - current year for website footer

{$VarName|date}
{$VarName|date:wrapDate=<span class="customClass">*</span>}
{$VarName|date:format=d.m.Y:[timestamp=2015-08-10 20:15:00]}
{$VarName|time:format=H\:M}
{$VarName|datetime:format=d.m.Y H\:M:[timestamp=2015-08-10 20:15:00]}

Matehematische Funktionen

Zahl runden |round

This is a function to round a numeric value to a optionally defined precision.

{$VarName|round:[precision= ]}

Attributes

precision(int) number of chars after the decimal point

Zahl aufrunden |ceil

This is a simple function to round up a numeric value.

{$VarName|ceil}

Zahl abrunden |floor

This is a simple function to round off a numeric value.

{$VarName|floor}

Variable berechnen |calc

This function ist intended to compute mathematic terms.
Notice: This is the replacement for the former function eval. Both functions (eval and calc) are sent through a filter, to remove critical strings and functions!

{$VarName|calc:input=string}

Attributes

input(string) string to evaluate or calculate by the function

Example - Calculation

You can use "$this" in your formula, to call the content of the current variable.

{$VarName|calc:input=$this+($VarName1+$VarName2)*100/2}

Variable berechnen |eval (depricated)

Notice: This function is depricated. Now use the function "calc". Both functions (eval and calc) are sent through a filter, to remove critical strings and functions!

{$VarName|eval:input=string}

Attributes

input(string) string to evaluate or calculate by the function

Example - Calculation

You can use "$this" in your formula, to call the content of the current variable.

{$VarName|eval:input=$this+($VarName1+$VarName2)*100/2}

Link generieren |link

It is possible to generate a link from different data like page-UID or URL and optionally adding some params and an anchor.
As result you get an link for using in an <a>-tagwith all required data.
The variable should contain the page-UID or the URL.
Alternatively you can inject this data by by using the attributes.

{$VarName|link:href=123:[page=123]:[url=www.irgendwas.de]:[params=var1=val1&var2=val2...]:[anchor=abc]} {$VarName|link:[page=123]:[withtag=1]:[title=Link zu einer Seite]:[attribs=class="custom_class" id="link_id"]}

Attributes

href(string) Page-UID or URL even with params (universal input variable)
page(int) Page-UID
url(string) URL
alias(string) Optionally set a divergent Page-Alias
tail(string) Optionally add last part of SEO-URL (NewsCatTitle.1/NewsItemTitle.12)
language(string) Optionally set Language-UID
params(string) Optionally set a query-string (var1=val1&var2=val2)
vars(array) Optionally set a PHP-array with params
anchor(string) Optionally set a link anchor (without #)
absolute(bool) Output absolute paths
domain(string) Optionally set protocol and domain for absolute links
withtag(string) Output a full A-tag with link-text
text(string) Override the link-text
title(string) Override the link-title
target(string) Set the link-target
attribs(string) Set additional tag-attributes and values
attrib(string) Return only the value of one specific attribute (href, title, text, target, attribs)

Links in Texten generieren |makelinks

It is quite easy to convert all urls in a string to clickable links.
Use this short function to create links for URLs and e-mail-adresses.

{$VarName|makelinks}

E-Mail-Links maskieren |maskmailto

For some reasons sometimes it is required to mask e-mail-links to prevent them from beeing spidered.
The following function takes care of those e-mail-links an makes them spider safe, but keeps them clickable.

{$VarName|maskmailto:[replace=<span class="mailAt"></span>]:[attrib=href]}

If the e-mail-address in your string is not currently wrapped in an <a>-tag, you have to call the makelinks-function before. This is because the maskmailto-function can only handle <a>-tags as input.

{$VarName|makelinks|maskmailto}

To get only the crypted mailto-link use the funtion as follows.

{$VarName|makelinks|maskmailto:attrib=href}

Attributes

replace(string) Replacement for the @ in the e-mail-address (default set by sytem config)
attrib(string) 'href' returns only the masked content of the href-attribute

Kodierung

URL-Kodierung/-Dekodierung |urlencode |urldecode

Sometimes we need to encode or decode a string with the URL-encoding. And here we hab two simple functions for this.

<!-- Encode string -->
{$VarName|urlencode}
<!-- Decode string -->
{$VarName|urldecode}

Rand-Codierung/-Decodierung |randencode |rand_encode |randdecode |rand_decode

For some applications it is required to obfuscate the data just a little to prevent them from manipulation or just to make a better handling without linebreaks and special chars.
For this purpose we have two corresponding functions to encode and decode the data.

<!-- Encode string -->
{$VarName|randencode:[key=123]}
{$VarName|rand_encode:[key=123]}
<!-- Decode string -->
{$VarName|randdecode:[key=123]}
{$VarName|rand_decode:[key=123]}

Attributes

key(int) numeric key, has to be the same for encoding and decoding

Rot13-Codierung/Decodierung |rot13

As a another simple encoding, we have the ROT13-algorythm included.
This algorythm allows encoding and decoding with just one function.
Please note that this is a weak encoding, because it simply works with moving some chars a number of bits foreward or backward.

{$VarName|rot13}

md5-Codierung |md5

Sometimes we need md5-hashes for technical applications.
Here we can use the implemented PHP-based md5-function.
The result is an 32 bit long string, which can not decoded by a decoding-algorythm.

{$VarName|md5}

UBBC-Umwandung |ubbcdecode

Use this code for converting UBB-Code to HTML-Tags. Some applications, like the guestbook, may use UBB-Code. To show the meening of the UBB-Code, we have to convert it to the related HTML-Tags.

{$VarName|ubbcdecode}

Validierung Dateinamen- und URL-Alias |validatealias

If you want to use a string as a file-name or url-tail/url-alias, you can use this simple function. It will transform the string like it´s usually done with filenames and url-tails by the CMS.

{$VarName|validatealias}

Listen-Funktionen

Listen generieren |list

With this function you can convert a number of textlines (separated by a line-break) to an ordered or unorderded list.

{$VarName|list:[type=ul]:[id=]:[class=]}

Attributes

type(string) [ul/ol] Set the list-type
id(string) id-attribute for the ol/ul-tag
class(string) CSS-class for the ol/ul-tag

Tabellen-Funktionen

Tabelle generieren |table

We can transform text-contents into tables. For this the data needs to be separted in lines and have deleimiters for separating the columns. These requirements are typically met by csv-data. We can handle those data from a string or a file.
The attributes "dir" and "src" are only relevant, if source is a file.

{$VarName|table:[delimiter=;]:[class= ]}

Attributes

dir(string) [path] Relative path to the data-file
src(string) [filename] Filename of the data-file
id(string) Value for id-attribute of the table-tag
class(string) Value for class-attribute of the table-tag
delimiter(string) Delimiter for the columns in the data-file
caption(string) The table-Caption
type(int) [1-5] Design-type of the table
headtop(bool) Set th-tags in the first row
headleft(bool) Set th-tags in the first column
headright(bool) Set th-tags in the last column
headbottom(bool) Set th-tags in the last row
zebrarows(bool) Set alternating background-color for rows
zebracolumns(bool) Set alternating background-color for columns
fullwidth(bool) Set the table-with to 100%

Attributes with limited support

width(int/percent) value for width-attribute
cellspacing(int) value for cellspacing-attribut
cellpadding(int) value for cellpadding-attribut

Media-Funktionen

Image-Container |image

This function is made to resize, cache and display one or more images.
For working with this function it is required for the data to be in the system-internal xml-format <img src="filename.ext" zoom="1" width="200" /><img src=.../>
If the data has not the pemised format you can create it, for example using the wrap-function.

{$VarName|image:path=data/CMM_Contents/images/:[start=0]:[number= ]:[border= ]:[zoom= ]:[cache=1]:[width= ]}

Attributes

path(string) [path] Relative path to image-files
start(int) [0-n] Index of the first image to show
number(int) [1-n] Number of images to show
imageset(string) To mark belonging images - e.g. for skip-links in lightboxes
caption(bool) Show/hide image-caption
linkCaption(bool) Set the link also in the caption (for teaser-images)
border(bool) Show/hide border
zoom(bool) Enable/disable click-zoom
cache(int) [0,1,2] 0 = no cache, 1 = thumb- and zoom-image, 2 = only thumb-image
width(int) Image-width
height(int) Image-height
clip(string) Clip-position for differing image-proportions (center,left,right,top,bottom)
gray(bool) Reduce image to grayscale (only thumbnail)
sharpen(bool) Sharpen image (only thumbnail)
@2x(bool) Generate @2x-image (only from thumbnail and if source is larger than thumbnail) (default=1)
quality(int) [1-100] JPG/WEBP-quality (default 90/95)
round(bool) Make image round (50% border-radius via CSS - only thumbnail)
absolute(bool) Output absolute paths
attrib(string) Return only the value of an attribute ( e.g. href) ATTENTION: "attrib=orig" shows original file-names
wrapAll(string) Wrap araound all items <code>*</code>
wrapItem(string) Wrap araound one item <code>*</code>
wrapContent(string) Wrap around the image <code>*</code>
wrapCaption(string) Wrap around the caption <code>*</code>
imageIcon(string) [path] Path to a small icon/logo-file to render in the thumb-image
imageWatermark(string) [path] Path to a watermak-file to ronder in the thumb-image
imageZoomIcon(string) [path] Path to a small icon/logo-file to render in the zoom-image
imageZoomWatermark(string) [path] Path to a watermak-file to ronder in the zoom-image
origianl(bool) Use original image without image-proccessing
external(bool) Use image from external source - keep absolute path
import(bool) Import image from external source

Video-Container |video

This function is made to resize and display one or more videos.
For working with this function it is required for the data to be in the system-internal xml-format <video src="filename.ext" zoom="1" width="200" /><video src=.../>
If the data has not the pemised format you can create it, for example using the wrap-function.

{$VarName|video:path=data/CMM_Contents/videos/:[start=0]:[number= ]:[border= ]:[zoom= ]:[width= ]}

Attributes

path(string) [path] Relative path to files
start(int) [0-n] Index of the first file to show
number(int) [1-n] Number of images to show
caption(bool) Show/hide image-caption
border(bool) Show/hide border
startimage(string) [filename] Poster-image (same dir line video-files)
width(int) Video-width
height(int) Video-height
absolute(bool) Output absolute paths
attrib(string) Return only the value of an attribute ( e.g. src)
wrapAll(string) Wrap araound all items <code>*</code>
wrapItem(string) Wrap araound one item <code>*</code>
wrapContent(string) Wrap around the image <code>*</code>
wrapCaption(string) Wrap around the caption <code>*</code>

Audio-Container |audio

This function is made to resize, cache and display one or more audio-files.
For working with this function it is required for the data to be in the system-internal xml-format <audio src="filename.ext" zoom="1" width="200" /><audio src=.../>
If the data has not the pemised format you can create it, for example using the wrap-function.

{$VarName|audio:path=data/CMM_Contents/audios/:[start=0]:[number= ]}

Attributes

path(string) [path] Relative path to files
start(int) [0-n] Index of the first file to show
number(int) [1-n] Number of images to show
caption(bool) Show/hide image-caption
absolute(bool) Output absolute paths
attrib(string) Return only the value of an attribute ( e.g. href)
wrapAll(string) Wrap araound all items <code>*</code>
wrapItem(string) Wrap araound one item <code>*</code>
wrapContent(string) Wrap around the audio-content <code>*</code>
wrapCaption(string) Wrap around the caption <code>*</code>

Datei-Container |file

This function is made to resize, cache and display one or more file-links.
For working with this function it is required for the data to be in the system-internal xml-format <file src="filename.ext" zoom="1" width="200" /><file src=.../>
If the data has not the pemised format you can create it, for example using the wrap-function.

{$VarName|file:path=data/CMM_Contents/audios/:[filesize=1]}

Attributes

path(string) [path] Relative path to files
start(int) [0-n] Index of the first file to show
number(int) [1-n] Number of images to show
caption(bool) Show/hide image-caption
filesize(bool) Show filesize
target(string) Linkt target of the file-link
attrib(string) Return only the value of an attribute ( e.g. href)
wrapAll(string) Wrap araound all items <code>*</code>
wrapItem(string) Wrap araound one item <code>*</code>
wrapTitle(string) Wrap around the given title <code>*</code>
wrapCaption(string) Wrap around the caption <code>*</code>
wrapIcon(string) Wrap around the file-icon <code>*</code>

Link-Container |links

This function is made to render link-collections into special containers.
ATTENTION: Please note, this function-name is in plural (ends with "s"), because the singular function-name is used to generate simple links (look above).
For working with this function it is required for the data to be in the system-internal xml-format <link src="filename.ext" zoom="1" width="200" /><link src=.../>
If the data has not the pemised format you can create it, for example using the wrap-function.

{$VarName|links:page=(int):}

Attributes

page(int) Optional override the link-Page-UID
url(string) Optional override the link-URL
language(int) Language-UID to override the users original language
vars(array) Array with data to appen to the link
params(string) Optional query-string to append to the link
anchor(string) Append an anchor to the link (#...)
attrib(string) Return only the value of an attribute ( e.g. src)
group(int) UserGroupUID to override the users original usergroup

Some usefull tricks

<!-- Setting link to a defined page -->
{$Dummy|links:page=123}
<!-- Setting link to current page with keyword "this" -->
{$Dummy|links:page=this}

Spezielle CMM3-Funktionen

Captcha-Image |captcha

If your application needs a captcha field, you can use the captcha function of the form-class.
The output will be an Captcha-PNG with transparent background, an input field and a hidden field containing the md5-hash of the expected input.

{$VarName|captcha}

CMM3-Funktion/Methode anwenden |function

This is a special function for advanced developers, who want to use own functions on variables or constants.

{$VarName|function:[file=path]:[class=Classname]:[name=Functionname]:[param1=value1]:[param2=value2]:[...]}

Attributes

file(string) [path/filename] Path to the PHP-file - relative to CMM_ROOT_DIR
class(string) Name of the classe (optional)
name(string) Name of the Function/Method
param...(string) Any other parameter is collected to a paramsArray to use in the function

How this function works:

1. Include file
2. Create objekt of the class (if class is set)
3. Calls function/method

The call of the function/method goes this way:
OBJECT: TempObject = new Classname; TempObject->Functionname([1]$varContent,[2]$paramsArray)
FUNCTION: $varName = Functionname([1]$varContent,[2]$paramsArray)

As you can see your function should usually work with two parameters:
1. content of the variable
2. array of some additional params

Zählen von Seiten-Inhalten

Sometimes we need to know if or how much contents are in a page or in one column of the page. One example is to output some HTML, only if there are contents present. If we can´t use the content-plugin, we have a second chance to answer this question by using the following function.
(Note: This function counts only primary contents, not nested ones.)

<!-- Use in a condition -->
{if CMM_countContents('',array('columnUID'=>3))}
  Conditional output
{/if}
<!-- Use in a variable -->
{$VarName|function:name=CMM_countContents:[columnUID=3]:[pageUID=...]}

Attributes

columnUID(int) UID of the column (optional)
pageUID(int) UID of the page (optional)
languageUID(int) UID of the language (optional)
UID(int) UID of one content (optional)
contentUID(int) UID of a parent content (optional) (returns number of sub-contents)
customergroupUID(int) UID of the user-group (optional)

PHP-Code {php} {/php} - blocked!

In the beginning of the system we thought it was a good idea to have the possibility of running php statements in the code.
But finally we came to the thought that this is a bad idea, because of the security issues.
Therefore we have disabled this feature in the template-engine!

{php} PHP-Code {/php}

Sub-/Templates

HTML-Templates einbinden {template} {/template}

Sometimes it makes sense to outsource parts of templates in external files to increase clarity and included it only, if it is required - for example if a condition is true.

<!-- Template-file -->
{template:CMM_Module/template/html/CMM_Module_template.html}
{/plugin}

  
<!-- Template-file with dynamic name -->
{template:CMM_Module/template/html/CMM_Module_template{$variable}.html}
{/plugin}

CMM3-Plugins

CMM-Plugins einbinden {plugin} {/plugin}

One really strong feature of the system is the use of plugins in contents and same in template.
This strength is based on three features:
1. We can insert attributes width dynamic values
2. We can use template-files for the output of most plugins
3. We can nest plugins by using template-files

Calling the plugin is quite easy:
The plugins has an opening- and a closing-tag.
After the colon in the opening tag you have to set the relative path to the plugin-file.
Between the tags you can set the attributes, one per line.

<!-- Simple plugin code -->
{plugin:CMM/plugins/CMM_CMM_Navi.php}
{/plugin}

  
<!-- Plugin-code with attributes -->
{plugin:CMM/plugins/CMM_CMM_Navi.php}
Attribute1 = SomeValue
Attribute2 = {$variableFromTemplate}
Attribute3 = {$GLOBALS['varName']}

#Attribute = 123 - disabled by leading '#'
{/plugin}

CMM3-Forms

CMM-Formular einbinden {form} {/form}

Onother fine feature of the system is the use of forms in contents and same in template.
These forms can be created with the form-editor of the basic-module or come from a form-template-file.
But regardless of the source the forms will just work like magic.

Calling the form is really simple:
The form uses an opening- and a closing-tag.
After the colon in the opening tag you have to set the relative path to the form-file or the UID of the form-record.
Between the tags you can set the attributes, one per line.
The form-attributes are mostly fixed, but it is not neccessary to set all.

{form:CMM/template/forms/kontakt-3col-intl.html}
CMM_formMail1toEmail = max.mustermann@domain.com
CMM_formMail1subject = The form-subject

#Attribute = 123 - disabled by leading '#'
{/form}

Attributes

CMM_formMail1enable(bool) Enable/disable mail to admin
CMM_formMail1fromEmail(string) Sender mail-address (customer) {$Email}
CMM_formMail1fromName(string) Sender mail-name (customer) {$Vorname} {$Nachname}
CMM_formMail1toEmail(string) Recipient mail-address (admin)
CMM_formMail1toName(string) Recipient mail-name (admin)
CMM_formMail1subject(string) Subject for mail to admin
CMM_formMail1text(string) Message for mail to admin - Guten Tag, <br />das Kontaktformular auf Ihrer Website {CMM_SITE_NAME} wurde ausgefüllt:<br /><br />{$FormData}<br /><br />{CMM_MAIL_ADMIN_SIGNATURE}
  
CMM_formMail2enable(bool) Enable/disable mail to customer
CMM_formMail2fromEmail(string) Sender mail-address (admin)
CMM_formMail2fromName(string) Sender mail-name (admin)
CMM_formMail2toEmail(string) Sender mail-address (customer) {$Email}
CMM_formMail2toName(string) Sender mail-name (customer) {$Vorname} {$Nachname}
CMM_formMail2subject(string) Subject for mail to customer
CMM_formMail2text(string) Message for mail to customer - Guten Tag, <br />Sie haben das Kontaktformular auf unserer Website {CMM_SITE_NAME} ausgefüllt und erhalten diese Nachricht als Bestätigung:<br /><br />{$FormData}<br /><br />Wir melden uns umghend bei Ihnen. <br /><br />{CMM_MAIL_ADMIN_SIGNATURE}
  
CMM_formType(string) [ajax/normal] ajax
CMM_formConfirm(bool) Display confirmation-page before submit
CMM_formSubmit(string) Text for submit-button
CMM_formReset(string) Text for reset-button
CMM_formSuccess(string) Text-message, displayed on success
  
CMM_input{array('Expose'=>'{$ImmoObjectExpose}', 'Kategorie'=>'{LANG_CMM_IMMO_CATEGORY_{$ImmoObjectCategoryID}}'}

Placeholder in Mail-Messages

The mail-message-texts can contain text with some "light" HTML.
But beware of code-line-breaks, because they are not allowed in attributes.
Furthermore the texts may contain some constants and variables.
The variables represent the fields like this {$Fieldname} or {$Fieldname['date']}.
But additionally we have some reserved variables and constants, listed in the following table

{CMM_SITE_NAME}Website name, as set in the config
{$FormData}An automatic generated and formated list of all fields and values from the form
{CMM_MAIL_ADMIN_SIGNATURE}E-Mail-Signature, as set in the config