asprin
Active member
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:
And to give a sample structure of
So ideally, the end result should be 15 but I'm getting it as 2.
What I'm missing here?
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:
<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 of
$foo
:
PHP:
array:4 [▼
"foo1" => array:5 [▶]
"foo2" => array:5 [▶]
"foo3" => array:1 [▶]
"foo4" => array:4 [▶]
]
So ideally, the end result should be 15 but I'm getting it as 2.
What I'm missing here?
Last edited: