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

section vs foreach

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


Joined: 05 May 2010
Posts: 11

PostPosted: Fri Jan 04, 2019 4:21 pm    Post subject: section vs foreach Reply with quote

Hi

I have read through the forum and cannot find a definitive answer. I know that section required an index to cycle through the records but that is the main difference.

Is it possible to supply me with a real life example of where I should use each of these.

The reason I ask is I am consiodering removing all of the {section} loops in my template but becasue there is over a hundred pages it is not something I will do on a whim.

Thanks for any help

shoulders
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Tue Jan 08, 2019 1:50 pm    Post subject: Reply with quote

"If it works, don't touch it."
You can write new code with foreach, if it's sufficient for your use case, but otherwise there's no difference in the results.
Back to top
View user's profile Send private message
shoulders
Smarty Rookie


Joined: 05 May 2010
Posts: 11

PostPosted: Tue Jan 08, 2019 1:56 pm    Post subject: Reply with quote

I think i might change to {foreach} loops becasue currently I an reliant on ADOdb generating indexes and it is confusing in the results when you are trying to debug.

thanks for the feedback. I hope to have my project finished soon so I can go a bit more public with it. Core code is getting done in this release and then the next version will have a modern based bootstrap 4.0 template utilizing smarty.
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 -> General 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