1. arrays in smarty are often used. to traverse arrays cyclically, use section or foreach. How can we get the array length or determine the number of arrays? You can use {$ array | count} to try it.
2.
{Foreach from = $ variable key = key name = Name iteam = value}
{$ Variable | @ count} // obtain the array Length
{$ Smarty. foreach. Loop. Index} // gets the element subscript of the current loop array, starting with 0
{$ Smarty. foreach. Loop. Iteration} // gets the number of current cycles, starting with 1
{$ Smarty. foreach. Loop. First} // if it is true, mark the first execution of the loop
{$ Smarty. foreach. Loop. Last} // if it is true, mark the last execution of the loop
{$ Smarty. foreach. Name. Last} // if it is true, mark the last execution of the loop
{$ Smarty. foreach. Loop. Show} // whether the current display is displayed
{$ Smarty. foreach. Loop. Total} // number of cycles
{/Foreach}
3. Control the number of cycles
{ForeachName = infolist from =$ Video_info_listItem = infolist}{AssignVaR=FloorValue =$ Smarty.Foreach. Infolist. Index}{If $ Floor& Lt; 5% & gt}
{* OrIf $ Smarty.Foreach. Infolist. Iteration <5 *}
<Li> {$ Infolist%} </LI>
{/If}
{/Foreach}