i have a smarty foreach loop over a list of elements. this loop must stop when it complete 10 iteration, ie foreach must end at the 10th element of list.
{foreach $b_list as $list}
<label>{$list['firstname']}</label>
{/foreach}
CodePudding user response:
{foreach $b_list as $list name=list10}
{if $smarty.foreach.list10.index == 10}
{break}
{/if}
<label>{$list['firstname']}</label>
{/foreach}
CodePudding user response:
{foreach $b_list as $list}
<label>{$list['firstname']}</label>
{if $list@iteration == 10}
{break}
{/if}
{/foreach}