RSS Feed/News Implement break for foreach in templates

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
24,625
Points
823

Reputation:

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...
Code:

Code:
<xf:foreach loop="$loopArray" value="$loopValue">
    <xf:if is="$loopValue.value == 1">
        ...Some code...
    </xf:if>
</xf:foreach>
In the above, the first item is the one that would be processed, but the foreach loop continues through all 100 entries...

Read more

Continue reading...
 
Status
Not open for further replies.
Top