smarty line wrap example table wrap, smarty line wrap
Add key=count in foreach
<{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}> ;
Place three <{$item.name}> in each line and change the parameters as much as you like!
<{foreach item=item from=$items key=count}>
<{if ($count+1) is div by 3}>
<{/if}>
<{/foreach}>
Another example of using cycle to do line breaks, but it can only achieve the effect of breaking two lines with two pieces of data in each line
<{foreach item=item from=$items}>
<{$item.name}> ; <{cycle values=" | ,
"}>
<{/foreach}>
< ;/tr>
http://www.bkjia.com/PHPjc/926155.html
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/926155.htmlTechArticlesmarty line wrapping example table wrapping, smarty wrapping adds key=count table {foreach item=item from=$ items key=count} {if $count is div by 2}tr {/if} td{$item.name}/td td...