Home  >  Article  >  Backend Development  >  smarty line wrap example table line wrap, smarty line wrap_PHP tutorial

smarty line wrap example table line wrap, smarty line wrap_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:11:58974browse

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



<{if ($count+1) is div by 2}><{/if}> ;
< {$item.name}> <{$item.summary}> <{$item.date} >


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}>
,"}>
<{/foreach}>
< ;/tr>
<{$item.name}> ;
<{cycle values="


http://www.bkjia.com/PHPjc/926155.html

truehttp: //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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn