Missing {while} and {for}, is there any replacement?
Posted: Tue Mar 20, 2012 2:02 pm
Hello,
I've to loop for 30 times in a news template (the sites requires 30 entrys for a automatic sliding). I've tried something like this:
{counter start=0 assign='index'}
{while $index < 30}
{foreach from=$items item=entry}
{if $index < 30}
// Output
{counter assign='index'}
{/if}
{/foreach}
{/while}
In my real code there also some stuff to deal with the situation, where $items is an array with zero entries. This loop should fill the output with exactly 30 entries. It might be, that there are just 26 entries. This should be used for a logo slider with 2 lines. I've found {while} and {for} in the smarty docu, but in cmsms it missing.
I've to loop for 30 times in a news template (the sites requires 30 entrys for a automatic sliding). I've tried something like this:
{counter start=0 assign='index'}
{while $index < 30}
{foreach from=$items item=entry}
{if $index < 30}
// Output
{counter assign='index'}
{/if}
{/foreach}
{/while}
In my real code there also some stuff to deal with the situation, where $items is an array with zero entries. This loop should fill the output with exactly 30 entries. It might be, that there are just 26 entries. This should be used for a logo slider with 2 lines. I've found {while} and {for} in the smarty docu, but in cmsms it missing.
