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