|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
novus Smarty Rookie
Joined: 17 Nov 2003 Posts: 7
|
Posted: Mon Nov 17, 2003 11:18 am Post subject: Section Problem |
|
|
May this will be easy but i couldn't resolve it. So i will make a section to show a image gallery. the problem is, that i have to change the section counter too show the gui in the way i like.
for e.g.
i use an array of image objects to iterate over. now i will show 3 images in one table row.
<smarty: section name=counter loop=$Images/>
<tr>
<td>first image<img src=<smarty: $Images[counter]->getPath() /></td>
<td>second image<smarty: $smarty.section.counter.total ++/><img src=<smarty: $Images[counter]->getPath() /></td>
<td>third image<smarty: $smarty.section.counter.total ++/><<img src=<smarty: $Images[counter]->getPath() /></td>
</tr>
<smarty: /section/>
the question now is, is it possible to do somethink like counter++ ??? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Mon Nov 17, 2003 2:58 pm Post subject: |
|
|
hi.
I'm not looking too closely at your code, but simple math operations were introduced with 2.6. You can try 2.6.0 RC3 if you want to try them out. You will not be able to use spaces in your math expressions and besides, the way you have written your increment ($smarty.section.counter.total ++) with an intervening space -- is probably not a wise practice anyhow.
Cheers. |
|
Back to top |
|
novus Smarty Rookie
Joined: 17 Nov 2003 Posts: 7
|
Posted: Wed Nov 19, 2003 9:52 am Post subject: |
|
|
Thank you for your tip. I red that the math operations are not quite good for the performance so i did it with a smarty plugin. |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Wed Nov 19, 2003 6:42 pm Post subject: |
|
|
Hi novus.
To be Clear: using the math plugin is indeed slower than you'd want--but the builtin math of 2.6.0+ actyually compiles to native php in your template--so it is faster than any plugin can do and more convenient as well. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|