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, see
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, see
This article describes how to use the smarty built-in function section. 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 subscripts of the loop are 0, 2, and 4, and the 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.