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

foreach continue and break?

 
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 -> Smarty 3
View previous topic :: View next topic  
Author Message
academo
Smarty Rookie


Joined: 19 Feb 2010
Posts: 9

PostPosted: Wed Sep 29, 2010 9:44 pm    Post subject: foreach continue and break? Reply with quote

I did ask about this but i need to be sure about

it is any operator in foreach like continue or break?

if isn't, can be implemented by a plugun function?

Thank you very much.
Back to top
View user's profile Send private message
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Thu Sep 30, 2010 8:41 pm    Post subject: Reply with quote

Please use search.
This question was asked several times.

For example here
http://www.smarty.net/forums/viewtopic.php?t=17416&highlight=break+continue
Back to top
View user's profile Send private message
academo
Smarty Rookie


Joined: 19 Feb 2010
Posts: 9

PostPosted: Thu Sep 30, 2010 9:09 pm    Post subject: Reply with quote

Thank you, and I'm sorry about search ;)
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Oct 01, 2010 1:52 pm    Post subject: Reply with quote

{break} and {continue} tags for flow control of {foreach},{section},{for} and {while} loops have been added today to the Smarty3 SVN version.
Back to top
View user's profile Send private message
academo
Smarty Rookie


Joined: 19 Feb 2010
Posts: 9

PostPosted: Fri Oct 01, 2010 2:45 pm    Post subject: Reply with quote

Excelent!! Great improve to smarty :D
Back to top
View user's profile Send private message
ZakMc
Smarty Pro


Joined: 04 Oct 2004
Posts: 182

PostPosted: Fri Oct 01, 2010 2:57 pm    Post subject: Reply with quote

U.Tews wrote:
{break} and {continue} tags for flow control of {foreach},{section},{for} and {while} loops have been added today to the Smarty3 SVN version.


What changed your mind?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Oct 01, 2010 4:16 pm    Post subject: Reply with quote

It's a fine line. {break} and {continue} tags may lure more business logic into templates, which is not a good thing. The best route is to do the work in PHP and assign exactly what you want displayed in the template. The template then just focuses on the presentation and a simple loop. That said, use your own discretion with these tags in the template.
Back to top
View user's profile Send private message Visit poster's website
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 -> Smarty 3 All times are GMT
Page 1 of 1

 
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