Home > Article > Backend Development > Parsing the for-like function implementation in smarty template_PHP tutorial
1. Function description, use smarty to loop the output 100 times on the page, similar to a for loop 100 times
{section name=total loop=100}
{$smarty. section.total.index+1} //Current index
{$smarty.section.total.iteration} //Used to display the number of loops
{/section}
{assign var=i value=0}
{section name=total loop=100}
{assign var=i value=$i+1} {$i} //Use assign
{/section}
Output result: 1 2 3 4 5 ... ... 100