1. You can try {$array| count}.
2.
Copy code The code is as follows:
{foreach from=$variable key=key name =name iteam=value}
{$variable|@count} // Get the array length
{$smarty.foreach.loop.index} // Get the subscript of the current loop array element, starting with 0
{$smarty.foreach.loop.iteration} // Get the current number of loops, starting with 1
{$smarty.foreach.loop.first} // When true, mark the first execution of the loop
{$ smarty.foreach.loop.last} // When true, mark the last execution of the loop
{$smarty.foreach.name.last} // When true, mark the last execution of the loop
{$smarty. foreach.loop.show} // Whether to display
currently {$smarty.foreach.loop.total} // Number of loops
{/foreach}
3. Control Number of loops
Copy code The 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.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328022.htmlTechArticle1. You can try {$array| count}. 2. Copy the code as follows: {foreach from=$variable key=key name=name itam=value} {$variable|@count} // Get the array length {$smarty.forea...