Chapter 11. Template system

Table of Contents

Simple Substitution
Advanced substitution
Substitution commands
Options

The template system is used both inline in the code using the templateRow() and templateQuery() functions as well as configurable by the system administrator for generating emails and documents. The basic template system is located in share/template.php, the UserTemplate class for emails and pdf template is located in share/templateclass.php. UserTemplate uses the base templating functions.

Simple Substitution

Simple substitution can be made by placing % signs around the name you want, %name% will be replace by the content of "name" in the array sent. If you want to put a text before or after (or both) only if there is a value to be shown you can use this form %(Name: )name(<br>)% for example. Using that nothing will be shown if name is empty and "Name: Test 1<br>" will be returned if there is something to be shown. %name(<br>)% and %(Name: )name% also work as expected.