Functional description

Within templates, advanced options are available for displaying the content of a template.

In addition to the usual variables, it is also possible to use a piece of code in templates to check these fields. For example, you can check whether a field has been filled in or has been assigned a specific value.

Variables are used with curly braces {VARIABLE}, in the code these curly braces are omitted.

Examples

Check for a filled field

When the company name is included in the customer form (this can also be only for the administrator), it is possible to fill this in for a specific customer. The code below makes it possible to check whether a field has been filled. In this case, the field COMP_NAME (company name) is checked. If it is filled, it will be used in the template, otherwise the customer name will appear.

<!-- IF COMP_NAME -->
    {COMP_NAME}
<!-- ELSE -->
    Dear {INITIALS} {LASTNAME}
<!-- ENDIF -->
Check for a specific value

The code below makes it possible to check for a specific value of a certain field. In this case, the field {SEX} is used. If it contains the value "Man", the word "sir" will appear in the template, otherwise "madam" will be shown.

Dear <!-- IF SEX == "Man" --> sir <!-- ELSEIF SEX == "Vrouw" --> madam <!-- ENDIF --> {INITIALS} {LASTNAME},
Placing comments in the template

To place comments in the code, you can use the following code.

<!-- IF 0 --> 
    Your comments can go here, because "0" is always false. 
<!-- ENDIF -->
Using LOOPS

There are various types of data in i-Reserve that have a one-to-many relationship. For example, options, questions, participants, etc. A reservation can contain multiple options. These variables can be recognized by the combination {loopname.variable}, for example {options.NAME}.

These variables can be retrieved by using a loop.

<!-- BEGIN loopname -->
    content text or loop variables {loopname.VARIABLE}
<!-- END loopname -->

<!-- BEGIN options -->
    {options.NAME} has been booked.<br />
<!-- END options -->
Show a specific value in the loop

It is possible to show a specific value in a loop or start from that value. For example, you may only want to show the first option or all options except the first one.

<!-- BEGIN loopname(2) -->
    content text
<!-- END loopname -->

The example above will display results starting from the third entry in the loop.

loopname(2,4) Starts the loop at the third value and ends at the fourth
loopname(-4) Starts the loop from the fourth value from the end of the loop
loopname(2,-4) Starts the loop from the third value and ends at the fourth from the end of the loop