defined

The defined test checks to see if a variable is defined in the current context.

Examples

Test to see if a variable is defined.

{% if foo is defined %}
   ...
{% endif %}

Test a variable attribute or an array key value.

{% if foo.bar is defined %}
   ...
{% endif %}
{% if foo['bar'] is defined %}
   ...
{% endif %}

 Negative test:

{% if foo is not defined %}
   ...
{% endif %}
This documentation is only for Aptuitiv CMS. Learn more.
Get Started With Aptuitiv