Help center

Go to Signitic

Tips for your conditions

Here you will find several tips to help you simplify your conditions

How {% else %} works

The {% else %} simplifies and clarifies your conditions. Here is an example of its use in your template:

Old syntax:

{% if empty telephone %}{{groupe_telephone}}{% endif %}{{telephone}}

New syntax:

{% if empty telephone %}{{groupe_telephone}}{% else %}{{telephone}}{% endif %}

This means: If the phone is empty, then we display the group phone, otherwise, we will display the phone attribute.

With the old syntax, the attribute was added outside the condition, but now it is fully part of it thanks to {% else %}

Creating a double condition using the prefix

In cases where you want to add text only under certain conditions, and this condition is not necessarily specified for the user, you can use the prefix technique. Here is an example:

The basic condition:

{{if internal}}Direct line: {{extra_field_user}}{{endif}}

In this case, this line of code will always display the text “Direct line:” and {{extra_field_user}} if the email is internal. But if {{extra_field_user}} is not provided, it will not appear, whereas the text “Direct line:” will still appear.

The prefix technique will therefore be used to work around this issue.

The solution:

{{if internal}}{{extra_field_user|prefix=Direct line: }}{{endif}}

The goal is therefore to add the prefix in the field {{extra_field_user}} like this: '{{extra_field_user|prefix=Direct line: }}.

This will ensure that “Direct line:” is displayed before {{extra_field_user}} only if this attribute is provided.

Did this answer your question?
😞
😐
😁