ARCOS 7 Help

Template Logic

Very often in templates, you want different HTML to be output under different circumstances. You can use conditional statements in your code to do this.

Our templating system uses the following conditional statements:

if statements

<tmpl_if expression>
Code block
</tmpl_if>

if/else statements

<tmpl_if expression>
Code block A
<tmpl_else>
Code block B
</tmpl_if>

Nested if/else statements

<tmpl_if expression>
Code block A
<tmpl_else>
<tmpl_if expression>
Code block B
</tmpl_if>
</tmpl_if>

Unless statements

<tmpl_unless expression>
Code block
</tmpl_unless>

Loops

<tmpl_loop loop_name>
Code block
</tmpl_loop>

The expression can be a variable or condition that can be evaluated to true or false. Learn more about expressions.