Silverstripe Version: 4.x
Question:
I would like to loop over this array in my template
array(2) {
[0]=>
array(3) {
["menu_title"]=>
string(5) "Segment title 1"
["entry_url"]=>
string(442) "https://example.com"
["Apps"]=>
array(2) {
[0]=>
string(15) "App123"
[1]=>
string(20) "App321"
}
}
[1]=>
array(3) {
["menu_title"]=>
string(2) "Segment title 23"
["entry_url"]=>
string(145) "https://another-example.com"
["Apps"]=>
array(3) {
[0]=>
string(15) "App765"
[1]=>
string(20) "App628"
[2]=>
string(41) "App23"
}
}
}
Template idea
<% loop $leftMenuItems %>
<ul>
<% loop $What_goes_here_?? %>
<li>$menu_title</li>
<li>$entry_url</li>
<ul>
<% loop $Apps %>
<li>$What_goes_here_??</li>
<% end_loop %>
</ul>
<% end_loop %>
</ul>
<% end_loop %>
I have been looking through the documentation but I haven’t found a solution. Can I use this array for the loop in template? If not, how should the template look like?