This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

OrbitPodium
OrbitPodium

I has a menu with code 'footer-menu' in created in Static Page Plugin. This menu has 2 items one type of "All Static Pages" and another type of "All JK Shop Categories".

In my html i had this code:

<div class="col-md-3">
    <h3>Categories</h3>
    <ul class="categories">
    {% for item in staticMenu.menuItems %}
        <li><a href="{{ item.url }}" {{ item.viewBag.isExternal ? 'target="_blank"'}}>{{ item.title }}</a></li>
    {% endfor %}
    </ul>
</div>
<div class="col-md-3">
    <h3>Static Pages</h3>
    <ul class="shot-links">
    {% for item in staticMenu.menuItems %}
        <li><a href="{{ item.url }}" {{ item.viewBag.isExternal ? 'target="_blank"'}}>{{ item.title }}</a></li>
    {% endfor %}
    </ul>
</div>

but i need i kind of this:

<div class="col-md-3">
    <h3>Categories</h3>
    <ul class="categories">
    {% for item in staticMenu.menuItems %}
        {% if item typeof 'all-jk-shop-categories' %}
        <li><a href="{{ item.url }}" {{ item.viewBag.isExternal ? 'target="_blank"'}}>{{ item.title }}</a></li>
        {% endif %}
    {% endfor %}
    </ul>
</div>
<div class="col-md-3">
    <h3>Static Pages</h3>
    <ul class="shot-links">
    {% for item in staticMenu.menuItems %}
        {% if item typeof 'all-static-pages' %}
        <li><a href="{{ item.url }}" {{ item.viewBag.isExternal ? 'target="_blank"'}}>{{ item.title }}</a></li>
        {% endif %}
    {% endfor %}
    </ul>
</div>

Someone to help me?

OFFLINE
OFFLINE

The simplest solution to this problem would be to create to completely separate navigations for Categories and Static Pages.

Alternatively, when editing a menu entry, you can set a custom code under the Attributes tab. You should be able to access this code in your for loop. I'm not sure the code get's transferred to the dynamically generated child items though. If so, you should be able to do something like this (untested):

{% for item in staticMenu.menuItems %}
    {% if item.code == 'static-page' %}
        <li>{{ item.title }}</li>
    {% endif %}
{% endfor %}

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.