While
2 min read
Jun 2, 2026
---
title: while
autoseo:
enabled: true
theme: learn2
child_type: default
admin:
children_display_order: collection
visible: true
---
while — loops in Tplix have much the same flexibility as PHP while statements, with a few added features for the template engine. Every {while} must be paired with a matching {/while}. All operators are recognized, such as ==, ||, or, &&, and, etc and you can use modifiers as functions, such as is_array().
{while $foo > 0}
{$foo--}
{/while}
The above example will count down the value of $foo until 1 is reached.
{$foo--} values will not display in while, so if you want to display
$foo values than use before or after {$foo--} this {$foo}
Leave a Comment