Volist label for processing template engine in thinkphp

Source: Internet
Author: User

Volist tags are used primarily for looping output datasets or multidimensional arrays in templates

The required attributes are: The Name property, the data template variable to output, and the ID is the loop variable.

See the Development Manual for additional properties.

The result of the typical model's Select method is a two-dimensional array that can be output directly using the volist tag.

First, it is assigned to the corresponding controller.

$Student =m (' Student ');

$list = $Student->select ();

$this $assgn (' list ', $list);

Define the loop output number and name in the template

<volist name= "list" id= "Vo" mod= "1" >

{$vo. ID}

{$vo. Name}

</volist>

The Name property in the volist tag cannot be changed arbitrarily, but the ID property is not named the same as the Name property.

At the same time the label supports output part of the data, such as the output of the 5~15 record:

<volist name= "list" id= "Vo" offset= "5" length=10>

{$vo. Name}

</volist>

Supports output even records

<volist name= "list" id= "Vo" mod= "2" >

<eq name= "mod" value= "1" >{$vo .name}</eq>

</volist>

See the development manual for specific other tags

Volist label for processing template engine in thinkphp

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.