How to render a tree in Twig
I played around with domi27’s idea and came up with this. I made a nested array as my tree, [‘link’][‘sublinks’] is null or another array of more of the same. Templates The sub-template file to recurse with: <!–includes/menu-links.html–> {% for link in links %} <li> <a href=”https://stackoverflow.com/questions/8326482/{{ link.href }}”>{{ link.name }}</a> {% if link.sublinks %} … Read more