You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test 1: No Nested {literal}{foreach}{/literal}
---------------------------
{foreach$array as $item}{$item@iteration}: {$item.var} <---Note@iteration(sequential,asexpected){if$item@last}Last!(parent){/if}{/foreach}Test2:WithNested {literal}{foreach}{/literal}
-----------------------------
{foreach$array as $item}{$item@iteration}: {$item.var} <---Note@iteration(notsequential){foreach$item.sub as $sub}{$sub@iteration}:{$sub.var}{if$sub@last}Last!(sub){/if}{/foreach}{if$item@last}Last!(parent){/if}{/foreach}^---Notethelackofthe"Last! (parent)"
Output
Test 1: No Nested {foreach}
---------------------------
1: Parent 1 var <--- Note @iteration (sequential, as expected)
2: Parent 2 var <--- Note @iteration (sequential, as expected)
Last! (parent)
Test 2: With Nested {foreach}
-----------------------------
1: Parent 1 var <--- Note @iteration (not sequential)
1: Sub 1 var
2: Sub 2 var
Last! (sub)
3: Parent 2 var <--- Note @iteration (not sequential)
1: Sub 1 var
2: Sub 2 var
Last! (sub)
^--- Note the lack of the "Last! (parent)"
The text was updated successfully, but these errors were encountered:
smarty-foreach-test.php
smarty-foreach-test.tpl
Output
The text was updated successfully, but these errors were encountered: