Defining Variables

Within FLEX, you can define variables to any string or number that you can use for computational purposes. For example, lets say you are looping through subcategories tied to a category page. On each 5th one, you want load different html. You can define a variable and reset it once the operation is complete.

{% define $x = 1 %}
{% define $myVar = ‘Hello World’ %}

Defining and calling a defined variable must start with ‘$’ just like in PHP.

To call a defined variable:

<!-- output -->

{% if $x == 0 %}
I Love FLEX!
{% endif %}

Start your free, no-risk trial today.