Reputation: 8208
Is it possible to create a local variable or a for loop (instead of foreach) in a jtemplate? I want to give unique id's to the HTML elements and need a counter or something. Thanks!
Upvotes: 1
Views: 2098
Reputation: 14943
use $index
$index - index of the element in the table
$iteration - ID of the iteration (the next number begins from 0)
$first - is this the first iteration?
$last - is this the last iteration?
$total - the total number of iterations
ex
{#foreach $T.Rows as row}
$T.row$index
{#/for}
read http://www.codeproject.com/Articles/45759/jQuery-jTemplates-Grid
Upvotes: 4