Lee Well-known member Jul 7, 2016 #1 I have this loop that i'm using in my heavily cutomised profile page. It selects every post to be submitted to the users profile. Is there a way to limit the amount of records selected? <xen:foreach loop="$profilePosts" value="$profilePost"> </xen:foreach>
I have this loop that i'm using in my heavily cutomised profile page. It selects every post to be submitted to the users profile. Is there a way to limit the amount of records selected? <xen:foreach loop="$profilePosts" value="$profilePost"> </xen:foreach>
Chris D XenForo developer Staff member Jul 7, 2016 #2 You can add an i attribute to the loop and each iteration will increment i by one: Code: <xen:foreach loop="$profilePosts" value="$profilePost" i="$i"> <xen:if is="$i < 5"> // Do something </xen:if> </xen:foreach> Upvote 0 Downvote
You can add an i attribute to the loop and each iteration will increment i by one: Code: <xen:foreach loop="$profilePosts" value="$profilePost" i="$i"> <xen:if is="$i < 5"> // Do something </xen:if> </xen:foreach>
Chris D XenForo developer Staff member Jul 8, 2016 #4 Sorry: Code: <xen:foreach loop="$profilePosts" value="$profilePost" i="$i"> <xen:if is="{$i} < 5"> // Do something </xen:if> </xen:foreach> Upvote 0 Downvote
Sorry: Code: <xen:foreach loop="$profilePosts" value="$profilePost" i="$i"> <xen:if is="{$i} < 5"> // Do something </xen:if> </xen:foreach>