7.1.8. sections

Template-'sections' werden verwendet, um durch Arrays zu iterieren. Jedes section-Tag muss mit einem /section-Tag kombiniert werden. name und loop sind erforderliche Parameter.

Beispiel 7.10. sections

  
          
      {section name=i loop=$featured_array}
            {* 'first' ist 'true', wenn die aktuelle Iteration 
                die erste dieser 'section' ist. *}
            {if $smarty.section.i.first}
               <table>
            {/if}
                <tr>
                  <td>{$featured_array[i].products_name}</td>
                  <td>{$featured_array[i].products_price}</td>
                </tr>
           {* 'last' ist 'true' wenn die aktuelle Iteration 
                die letzte dieser 'section' ist. *}
           {if $smarty.section.i.last}
             </table>
           {/if}
     {/section}