Parsing the for-like function implementation in smarty template_PHP tutorial

WBOY
Release: 2016-07-21 15:05:00
Original
835 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!