|
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 |
iriePub Smarty Regular
Joined: 16 Jun 2006 Posts: 53
|
Posted: Tue Aug 15, 2006 11:50 am Post subject: How to do a for-Iternation in Smarty? |
|
|
Hi,
if I have something like that in PHP:
Code: |
$max = 10;
for($i = 20; $i > $max; $i--) {
echo 'this is image ' . $i . '<br />';
}
|
Now I want the template to execute a for-Iteration, that depends on $max. I assign $max to Smarty like this:
Code: |
$smarty->assign('max', $max);
|
But how to do the Iteration in Smarty?
Thanks!! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Tue Aug 15, 2006 12:16 pm Post subject: |
|
|
{section name=loop loop=$max} ... {/section} |
|
Back to top |
|
iriePub Smarty Regular
Joined: 16 Jun 2006 Posts: 53
|
Posted: Tue Aug 15, 2006 12:44 pm Post subject: |
|
|
I'll try it, thanks!! |
|
Back to top |
|
iriePub Smarty Regular
Joined: 16 Jun 2006 Posts: 53
|
Posted: Tue Aug 15, 2006 4:32 pm Post subject: |
|
|
hm, I don't understand it.
How can I do it like above posted, that I have a start value, and I give the direction of the development (increase / decrease) and the final value ?! |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
|
Back to top |
|
iriePub Smarty Regular
Joined: 16 Jun 2006 Posts: 53
|
Posted: Tue Aug 15, 2006 8:40 pm Post subject: |
|
|
Sorry, I didn't close enough to see the thing "step" |
|
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
|