Usage of the smarty built-in function section

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.