Smarty templates - printing array contents using modulus ..
Posted: Sun Aug 12, 2007 8:57 pm
Hi all,
I am literally this one thing away from finishing a program I am making, and am frustratingly stuck on what should be very simple. I have an array of varying length, and I would like it to print out 10 items from the array first, and then have a <br /> tag, and start the next 10, <br />, next 10, etc ..
I found this code online:
However, I had tried to use this code for my program and it doesnt seem to be working. The smarty template call is being made in a PHP file with this command:
$oTmp->assign(array(
And in that array one of the items is the array I am looping through. I can loop through the array in the HTML page just fine, the items display normally but it is still only printing them all on one line. Can anyone see whats wrong with my code and why the modulus code I have added isn't working? Any and all suggestions welcome.
Thanks!
I am literally this one thing away from finishing a program I am making, and am frustratingly stuck on what should be very simple. I have an array of varying length, and I would like it to print out 10 items from the array first, and then have a <br /> tag, and start the next 10, <br />, next 10, etc ..
I found this code online:
Code: Select all
[code]{section name=i loop=$items}
<Print out one item>
{if $oTmp.section.i.iteration % 9 == 1}
<print br tag>
{/if}
{/section}[/code]$oTmp->assign(array(
And in that array one of the items is the array I am looping through. I can loop through the array in the HTML page just fine, the items display normally but it is still only printing them all on one line. Can anyone see whats wrong with my code and why the modulus code I have added isn't working? Any and all suggestions welcome.
Thanks!