Home >Backend Development >PHP Tutorial >What does specification mean? Introduction and usage analysis of smarty section

What does specification mean? Introduction and usage analysis of smarty section

WBOY
WBOYOriginal
2016-07-29 08:39:001408browse

The basic prototype is:
{section name = name loop = $varName[, start = $start, step = $step, max = $max, show = true]}
name: The name of the section, no need to add $
$loop: For the variable to be looped, assign must be used to operate on this variable in the program.
$start: The subscript to start the loop. The loop subscript starts from 0 by default.
$step: The increment of the subscript during each loop.
$max: The maximum loop subscript.
$show: boolean type, which determines whether to display this block. , the default is true
There is a noun here that needs explanation:
Cyclic subscript: Its actual English name is index, which means index. Here I translate it into "subscript", mainly for easy understanding. It represents the current loop index when displaying this loop block. It starts from 0 by default and is affected by $start. If $start is set to 5, it will also start counting from 5. We have used it in the template design part. This It is an attribute of the current {section}. The calling method is Smarty.section.sectionName.index. The sectionName here refers to the name attribute in the function prototype. The attribute values ​​​​of the
{section} block are:
1. index: the "loop subscript" we introduced above, the default is 0
2. index_prev: the previous value of the current subscript, the default is -1
3. index_next: the next value of the current index, the default is 1
4. first: whether it is the first loop
5. last: whether it is the last loop
6. iteration: the number of loops
7. rownum: the current row number, Another alias of iteration
8. loop: the last loop number, which can be used to count the number of loops in the section after the section block
9. total: the number of loops, which can be used to count the number of loops after the section block
10. show: in the declaration of the function It is included in and is used to determine whether the section is displayed.

The above introduces what specification means, the introduction and usage analysis of smarty section, including what specification means. I hope it will be helpful to friends who are interested in PHP tutorials.

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