Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Adding While loops to Smarty
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
Vicky`s Webgeek
Smarty Rookie


Joined: 07 Mar 2007
Posts: 9

PostPosted: Wed Mar 07, 2007 8:08 pm    Post subject: Reply with quote

damn.

I was sure when I looked at {section} that you needed to pass an array to the loop parameter.

Embarassed

well, I *still* think adding a while loop is a pretty cool hack.

And, if anyone else wants the ability to shoot themselves in the foot with a potentially infinite loop, now they can -- With all the caveats that come along with it. Wink
Back to top
View user's profile Send private message
tpr
Smarty Rookie


Joined: 27 Mar 2006
Posts: 8

PostPosted: Mon Mar 19, 2007 7:48 pm    Post subject: Reply with quote

I wouldn't beat yourself up too bad over it as you were not the only one. I came here today looking for the same thing basically.

I have a template that I needed to draw X number of controls on whether there was data passed to it or not. This is a perfect case of some form of loop.

It was not blatantly obvious to me either that you could set loop to a number as opposed to an array to get it to iterate X number of times.
Back to top
View user's profile Send private message
emmbec
Smarty Rookie


Joined: 01 May 2009
Posts: 10

PostPosted: Thu May 06, 2010 2:15 am    Post subject: Reply with quote

Well right now I am having a problem where the WHILE loop seems to be my only solution. I am simply writting rows for an HTML table, and I am doing it with a section loop. However inside the loop I need to check some mathematical condition that when TRUE, I need to decrement the current loop index or force the loop to go one more step from the original max value. Unfortunately I have not been able to do so with the current section loop that smarty has, so this WHILE loop is my only solution at this moment, unless someone knows a way to alter a LOOP's index or make it go just an extra round in case some condition happens Razz

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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
Protected by Anti-Spam ACP