0
我期待與定製的DjangoCMS模板sub_menu.html,並已得到了目前在菜單下面的代碼:DjangoCMS/Django的 - 如果檢測到當前頁面是孩子
{% if children %}
<div class="unit subnav">
<h3>{% page_attribute "menu_title" %}</h3>
<ul>
{% for child in children %}
<li class="{% if child.selected %}on{% endif %}{% if child.ancestor %}ancestor{% endif %}{% if child.sibling %}sibling{% endif %}{% if child.descendant %}descendant{% endif %}">
<a href="{{ child.attr.redirect_url|default:child.get_absolute_url }}" title="{{ child.get_menu_title }}">{{ child.get_menu_title }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
所以基本上,這個檢測如果該頁面有子項,並且如果存在該頁面的子項,則添加子導航。
到目前爲止,這麼好。
我的問題是,當我導航到自己的子頁面 - 菜單消失,所以我想檢測頁面是否是1級以下的「孩子」。這應該停止所有具有導航的頁面(因爲他們都是我設想的首頁的子女),但應允許低於主要導航級別的人員出現菜單。
如果任何人都能伸出援助之手或指向正確的方向,那就太棒了。