smarty table line wrapping example, smarty table line wrapping
The example in this article describes the implementation method of smarty table line wrapping. Share it with everyone for your reference. The specific analysis is as follows:
Add key=count
to foreach
Copy code The code is as follows:
<{foreach item=item from=$items key=count}>
<{if $count is div by 2}>
<{/if}>
<{$item.name}> |
<{$item.summary}> |
<{$item.date}> |
<{if ($count+1) is div by 2}>
<{/if}>
<{/foreach}>
Place three <{$item.name}> in each line, followed by a new line. Just change the parameters as much as you like!
Copy code The code is as follows:
<{foreach item=item from=$items key=count}>
<{$item.name}> |
<{if ($count+1) is div by 3}>
<{/if}>
<{/foreach}>
Another example of using cycle to do line wrapping, but it can only achieve the effect of wrapping two data lines per line. It can only wrap two lines
Copy code The code is as follows:
<{foreach item=item from=$items}>
<{$item.name}>
<{cycle values=" | ,
"}>
<{/foreach}>
I hope this article will be helpful to everyone’s PHP programming.
http://www.bkjia.com/PHPjc/928227.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/928227.htmlTechArticlesmarty table line wrapping example, smarty table line wrapping This example describes the implementation method of smarty table line wrapping. Share it with everyone for your reference. The specific analysis is as follows: Add ke...
to foreach