|
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 |
shoulders Smarty Rookie
Joined: 05 May 2010 Posts: 11
|
Posted: Fri Jan 04, 2019 4:21 pm Post subject: section vs foreach |
|
|
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 |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Jan 08, 2019 1:50 pm Post subject: |
|
|
"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 |
|
shoulders Smarty Rookie
Joined: 05 May 2010 Posts: 11
|
Posted: Tue Jan 08, 2019 1:56 pm Post subject: |
|
|
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 |
|
|
|
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
|