PDA

View Full Version : Template with inline JavaScript for loop



youknowho
29 Sep 2010, 6:47 AM
Is it possible to execute a standard JavaScript for loop inside {[...]} ? Attempts at doing this inside a XTemplate have not worked so far. I'd like to do something like:



' <tpl for="myItems">',
' {[for (var i=0; i<=5; i++) { ]}
' <tpl for="item"' + i + '>',
' <a href={url}>{title}</a>',
' </tpl>',
' {[ } ]}',
' </tpl>',