Home >Backend Development >PHP Tutorial >Smarty table line wrapping example, smarty table line wrapping_PHP tutorial

Smarty table line wrapping example, smarty table line wrapping_PHP tutorial

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

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

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

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

<{if ($count+1) is div by 3}><{/if}>
<{/foreach}>
<{$item.name}>

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}> 
,"}> 
<{/foreach}>

<{$item.name}> 
<{cycle values="

I hope this article will be helpful to everyone’s PHP programming.

www.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
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