1. You can use {$array | count} to try it.
2.
Copy Code code as follows:
{foreach from= $variable key=key name=name Iteam=value}
{$variable | @count}//Get array length
{$smarty. Foreach.loop.index}//Get subscript for the current loop array element, starting at 0
{$smarty. foreach.loop.iteration}//Get the current number of loops, starting at 1
{$smarty. Foreach.loop.first} is true, the token loop executes for the first time
{$smarty. Foreach.loop.last} is true, the token loop is last executed
{$smarty. Foreach.name.last} is true, the token loop is last executed
{$smarty. Foreach.loop.show}//is currently displayed
{$smarty. Foreach.loop.total}//Cycle times
{/foreach}
3. Control cycle Times
Copy Code code 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*}
<li>{$infolist%}</li>
{/if}
{/foreach}