Smarty while-loop error

Official docs say smarty has β€œso far” support . However, I do the following in the template:

{while $foo > 0}
  {$foo--}
{/while}

and I get the following error:

Syntax error: unrecognized tag 'while' (Smarty_Compiler.class.php)

Can you help in solving this problem? Many thanks.

+3
source share
2 answers

You are probably using the old version (without while) smarty, so you get an error

+5
source

As @RC said, you are probably using Smarty v2. If you can’t upgrade to v3, you need to take a look {section}or maybe {foreach}for a loop.

+2
source

All Articles