This article mainly introduces the usage of the smarty built-in function section. The example analyzes the section usage skills and related parameter descriptions, which has some reference value, for more information about how to use the section of the smarty built-in function, see the example in this article. Share it with you for your reference. The specific analysis is as follows:
The foreach function can do everything that the section can do. Therefore, foreach is generally used. The section usage is also described in detail here. Section can only traverse the index array, but not the associated array.
The array key values output instances in reverse order:
Template file:Temp.htm
The Code is as follows:
{Section name = foo loop = $ name step =-1}
{$ Name [foo]}
{/Section}
Parameter description:
Name is the name of section;
Loop is the array variable of the loop;
Step is the cycle step. If step is 2, it indicates that only the number of the subscripts of the loop is 0, 2, 4, and step is negative, which indicates traversing from the end.
Name and loop are mandatory parameters.
I hope this article will help you with php programming.