I’m building something in a system that utilizes smarty version 2. The code I’m writing needs to utilize a while loop, however, the while loop was not introduced until version 3.
Can you simiulate a while loop using something like for or foreach? Maybe looping using two conditions or breaking out prematurely? What are my options?
PS: Installing the plugin to provide while loop functionality is not an option.
A for loop while loop is like so:
Demo: http://codepad.org/KPBUk4ZN
Read here for converting native PHP to smarty