2011-05-12 176 views
3

官方文檔說,smarty有'while'support。不過,我在模板中做到以下幾點:smarty while循環錯誤

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

,我得到以下錯誤:

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

可以請你這個問題幫助嗎?非常感謝。

回答

5

您可能正在使用的舊版本(無while)智者的,這就是爲什麼你的錯誤

2

正如@RC說,你可能正在使用Smarty的V2。如果你不能升級到v3,你會想看看{section}或者{foreach}的循環。