TEMPLATES
Template Syntax
13 min
target audience the target audience of this document are developers or persons with at least some software development experience template engine we are using pebble templates to populate email and document templates with data please be aware that we are still using version 3 0 4 of pebble templattes, because some of our custom extions are not yet compatible with the latest version of pebble important blocks loops {% for offer in offers %} {% endfor %} if blocks {% if test == 'teststring' %} {% elseif test == 'asdf' %} {% else %} {% endif %} important modifiers trim {{ " mein text " | trim }} numberformat by default a decimal point number will be printed with maximum precission in some cases you might want to use a custom format formatting a number as integer {{ item itemcount | numberformat('#') }} formatting a number with exactly two decimal points and a local specific thousand separator {{ item itemcount | numberformat('#,##0 00') }} nl2br sometimes you might encounter a multi line string, where the lines are separated by a newline character when you want to render such a string within an html template (keeping the line breaks) you have to convert the newline characters to html br (line break) elements {{ address | nl2br }} custom macros gender specific text {{greeting(guest gender, 'hallo herr', 'hallo frau', 'hallo')}} {{ guest lastname}} currency format {{money(offer unitpricesummary amount, offer unitpricesummary currency)}} custom extensions in certain situations the wyiwyg template editor would remove (or complain about) invalid markup e g when wrapping loops or if conditions around table cells or table rows in such cases you can add the for or if condition directly onto the html element as an attribute h for attribute \<tr h for="item in offer shoppingcart"> \<td>{{ item itemcount | numberformat("#") }} x {{ item inhouseservice name $locale }}\</td> \<td>{{ money(item unitpricesummary amount + item unitpricesummary excludedtaxamount, item unitpricesummary currency) }}\</td> \</tr> h if \<div h if="address != null"> {{ address }} \</div>