2011-10-22 12 views
5

tengo este código Smarty:contador de rizo interior iterate Smarty

{iterate from=fruits item=fruit} 
.... 
{/iterate} 

Quiero tener un contador dentro de este bucle que acepta un valor de inicio y aumentar en uno hasta que el bucle continúa.

¿Debo usarla? no soy bueno en sabelotodo.

Gracias.

Respuesta

1

En caso de que tenga algo como esto:

{foreach from=$fruits item=fruit} {/foreach} 

lugar de esto:

{foreach from=fruits item=fruit} {/foreach} 

Debe usar esta sintaxis:

{foreach from=$fruits item=fruit name=counter} 
    Iteration no {$smarty.foreach.counter.iteration} 
{/foreach}