This article mainly introduces the line feed method for smarty tables, which can be used to flexibly operate tables. For more information, see
This article mainly introduces the line feed method for smarty tables, which can be used to flexibly operate tables. For more information, see
This article describes how to implement line feed in a smarty table. Share it with you for your reference. The specific analysis is as follows:
Add key = count to foreach
The Code is as follows:
<{Foreach item = item from = $ items key = count}><{If $ count is p by 2}>
<{/If}>
<{$ Item. name}> |
<{$ Item. summary}> |
<{$ Item. date}> | <{If ($ count + 1) is p by 2}>
<{/If}><{/Foreach}>
Put three <{$ item. name}> lines in each row, and change the parameter if you like to change the line feed!
The Code is as follows:
<{Foreach item = item from = $ items key = count}>
<{$ Item. name}> | <{If ($ count + 1) is p by 3}>
<{/If}><{/Foreach}>
Another example is to use cycle for line feed, but the effect of line feed can only be changed to two rows when only two rows of data are in each row.
The Code is as follows:
<{Foreach item = item from = $ items}>
<{$ Item. name}> <{Cycle values =" | ,
"}><{/Foreach}>
I hope this article will help you with PHP programming.