nav: Allowed memory size exhausted
with max_depth and recursion
#7198
-
<ul>
{{ nav:collection:c max_depth="2" }}
<li>
<a href="{{ url }}">{{ title }}</a>
{{ if show_subcategories }}
<ul>
{{ *recursive children* }}
</ul>
{{ /if }}
</li>
{{ /nav:collection:c }}
</ul> With a category having a as much as 3 levels of hierarchy, when I omit max_depth it shows all 3 as expected. When I include max_depth="2", which should actually limit the depth and prevent the 3rd level from showing, I get this error:
Any tips to troubleshoot? 'show_categories' is a toggle field, if that matters. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Wrap the recursion in a condition. {{ if children }}
<ul>{{ *recursive children* }}</ul>
{{ /if }} or {{ if children && show_subcategories }} |
Beta Was this translation helpful? Give feedback.
Wrap the recursion in a condition.
or