Snog
Well-known member
I did a search and didn't find anything about this, so here we are...
It would be nice to be able to break out of a foreach loop in templates.
Consider this oversimplified example where $loopArray might have 100 entries...
In the above, the first item is the one that would be processed, but the foreach loop continues through all 100 entries (remember this is oversimplified).
The addition of a break from the foreach would speed processing simply by not processing the other 99 entries...
Again, this is oversimplified for clarity and not intended as a working example.
It would be nice to be able to break out of a foreach loop in templates.
Consider this oversimplified example where $loopArray might have 100 entries...
Code:
<xf:foreach loop="$loopArray" value="$loopValue">
<xf:if is="$loopValue.value == 1">
...Some code...
</xf:if>
</xf:foreach>
The addition of a break from the foreach would speed processing simply by not processing the other 99 entries...
Code:
<xf:foreach loop="$loopArray" value="$loopValue">
<xf:if is="$loopValue.value == 1">
...Some code...
<xf:break/>
</xf:if>
</xf:foreach>
Again, this is oversimplified for clarity and not intended as a working example.
Upvote
3