td_php tutorials for smarty in the form of loops in a template

Source: Internet
Author: User
Tags smarty template
Smarty templates using tables to iterate through data is a terrible thing to do and where to addLabel, where should addThe label is OK to say, if encounter that need to add colspan tag, that really have to hurt brain, but for this problem, I have a way to solve, now specially record the following, in case this situation. Specific code, for example, needs to be modified according to the actual situation:

{section loop= $student _list name=list} {if $smarty. Section.list.first | | $smarty. section.list.rownum%5==1} {/if} {$student _list[list].name} {if $smarty. Section.list.last = = 1 && $smarty. section.list.rownum%5! = 0} {/if} {if $smarty. section.list.last | | $smarty. section.list.rownum%5==0} {/if} {/section}

Note: The previous example loops over a five-column table

Articles you may be interested in

    • Smarty Cycle form and supplement form TD shortage situation
    • Smarty extension for loop in template
    • Use PHP functions in Smarty Templates and how to use multiple functions for a variable in a smarty template
    • The last record in the thinkphp template that determines the volist loop
    • Add latest tags to information in smarty templates
    • Smarty method for determining the empty array in a template
    • How to generate random numbers in a smarty template
    • How constants defined by define in the program are used in the Smarty template

http://www.bkjia.com/PHPjc/764169.html www.bkjia.com true http://www.bkjia.com/PHPjc/764169.html techarticle smarty template to use a table to iterate through the data is a very bad thing, where to add the TR tag, where to add the/tr tag is OK to say, if you encounter the kind of need to add colspan tag ...

  • 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.