Smarty newline instance table newline, smarty newline. Smarty newline instance table newline, smarty newline add keycounttable {foreachitemitemfrom $ itemskeycount} {if $ countisdivby2} tr {if} td {$ item. name} tdtd smarty newline instance table newline, smarty newline
Add key = count to foreach
<{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}> rows in each row and modify the parameters as much as you like!
<{Foreach item = item from = $ items key = count}>
<{$ Item. name}> | <{If ($ count + 1) is p by 3}>
<{/If}><{/Foreach}>
Another example is to use cycle to create rows, but only two rows can be created for each row.
<{Foreach item = item from = $ items}>
<{$ Item. name}> <{Cycle values =" | ,
"}><{/Foreach}>
Http://www.bkjia.com/PHPjc/926155.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/926155.htmlTechArticlesmarty wrap instance table wrap, smarty wrap add key = count table {foreach item = item from = $ items key = count} {if $ count is p by 2} tr {/if} td {$ item. name}/td...