Home  >  Article  >  Backend Development  >  Parsing the for-like function implementation in smarty template_PHP tutorial

Parsing the for-like function implementation in smarty template_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:05:00868browse

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327712.htmlTechArticle1. Function description, use smarty to loop output 100 times on the page, similar to for loop 100 times {section name=total loop=100} {$smarty.section.total.index+1} //Current index {$smarty.section.t...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn