Smarty for unrecognized loop tag

I just started using Smarty today, so I can do it completely wrong, but I can not find a solution to the problem. I am trying to get a for loop to repeat 4 times, increasing $ i at each iteration. Pretty standard stuff.

According to the Smarty documentation, there should be the following form for loops:

{for $var=$start to $end} 

My current loop statement is as follows:

 {for $i=0 to 3} 

But at runtime, I get the following error:

Fatal error: Smarty error: [in..views / landing / index.tpl line 69]: syntax error: unrecognized 'for' tag (Smarty_Compiler.class.php, line 590) c. / library / 1.11 / Smarty / Smarty.class.php on line 1093

The loop is on line 69, which is the line on which the compiler does not work. I also shortened the urls in this error message for easier reading.

I'm not sure what I'm doing wrong here. I tried looking for different parts of the error message, but to no avail.

Thank you for your time.

+7
source share
1 answer

I apologize. I just realized that Smarty V2 is running on our server. For loops not introduced until V3. If someone else encounters this problem and, like me, cannot upgrade, find {Section} and {foreach} . They are available in V2 and can do what you need.

+14
source

All Articles