1. You can use {$array | count} to try it.
2.
Copy CodeThe code is as follows:
{foreach from= $variable key=key name=name Iteam=value}
{$variable | @count}//Get array length
{$smarty. Foreach.loop.index}//Gets the current loop array element subscript, starting with 0
{$smarty. Foreach.loop.iteration}//Gets the current number of cycles, starting at 1
{$smarty. Foreach.loop.first}//Is true when the tag loop executes for the first time
{$smarty. Foreach.loop.last}//Is true when the tag loop is last executed
{$smarty. Foreach.name.last}//Is true when the tag loop is last executed
{$smarty. Foreach.loop.show}//is currently displayed
{$smarty. Foreach.loop.total}//Number of cycles
{/foreach}
3. Control cycle Times
Copy CodeThe code is as follows:
{foreach name=infolist from= $VIDEO _info_list item=infolist}
{Assign Var=floor value= $smarty. Foreach.infolist.index}
{if $floor <5%} {* or if $smarty. Foreach.infolist.iteration <5*}
{$infolist%}
{/if}
{/foreach}
http://www.bkjia.com/PHPjc/328022.html www.bkjia.com true http://www.bkjia.com/PHPjc/328022.html techarticle 1. You can use {$array | count} to try it. 2. Copy the code as follows: {foreach from= $variable key=key name=name iteam=value} {$variable | @count}//Get array length {$smarty. Forea ...