[RSS Feed/News] Incrementing counter inside loop of a template?

Status
Not open for further replies.

XenForo

Administrative
  • Thread starter
  • Admin
  • #1
This seems easy but for the life of me I'm unable to get it to work.

I've an array inside of an array and after both have been looped, I'm trying to get the total count of items iterated. Something like this:

HTML:

Code:
<xf:set var="$total">0</xf:set>
<xf:foreach loop="$foo" value="$child_array" i="$parent_count"> 
    <xf:foreach loop="$child_array" i="$child_count">
        <xf:set var="$total">{{$total + 1}}</xf:set>
    </xf:foreach>
</xf:foreach>
{$total}

And to give a sample structure...

Read more

ادامه مطلب...
 
Status
Not open for further replies.
Back
Top Bottom