The last record of the volist loop in the thinkphp Template

Source: Internet
Author: User

Anyone who has used smarty for php development should know whether the foreach loop in the smarty template can use $ smarty. foreach. name. last to determine whether the loop has reached the last record. How can we determine in thinkphp? In thinkphp templates, the common cycle is volist, And the volist attributes do not directly judge this. The following describes how to judge the last record in thinkphp volist.

The sample code is as follows.

<Volist name = 'lists' id = 'LIST'> <li <if condition = "$ I eq count ($ lists) "> class =" last "</if> <a href =" http://www.phpernote.com/tag/thinkphp "> thinkphp tutorial </a> </li> </volist>

$ I in the above code snippet is a counting variable in the volist loop. The default name is $ I, so you can directly use it without declaration.

Articles you may be interested in
  • Thinkphp prints the last SQL statement
  • Use php functions in the smarty template and how to use multiple functions for a variable in the smarty Template
  • The cycle table in the smarty template contains incomplete td
  • Method for judging null array in the smarty Template
  • Summary of common system variables in Thinkphp templates
  • Thinkphp intercepts Chinese strings
  • Extension of the for loop in the smarty Template
  • ThinkPHP built-in template engine usage Summary

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.