Accessing third level menu in Static Pages via twig.
Ad
I have a dropdown menu which uses the static pages menu to generate the navigation.
How do I reference third level items? Here is a picture explaining a typical layout
I know bootstrap doesn't allow 3rd level menu without mods but its the the twig calls I am trying to work out.
There is a call for item.items and subitem in item.items. But what about the next level of items?
Here is my menu so far
<ul class="nav navbar-nav navbar-right">
<li><a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ '/'|app }}"><i class="typcn typcn-home"></i></a></li>
{% for item in items %}
<li class="{{ item.isActive or item.isChildActive ? 'active' : '' }} {{ item.items ? 'dropdown' : '' }}">
<a title="{{ item.title }}" {% if item.items %} class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria- expanded="false" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"{% else %} target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ item.url }}" {% endif %}>{% if item.items %} {{ item.title }} <span class="caret"></span>{% else %} {{ item.title }} {% endif %}</a>
{% if item.items %}
<ul class="dropdown-menu">
{% for subitem in item.items %}
<li>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="{{ subitem.url }}">{{ subitem.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
Ad
Answer
Ad
The third level items are in
subitem.items
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad