Django-cms menu template tag issue
HI im totally stuck with this one at the moment and i really hope so开发者_开发百科meone can help me out with this problem.
I have a django / django-cms build that contains a lot of pages. the site is divided up in to 4 main sections, lets say these sections are grand parents. each grand parent can have a number of children, which in turn can have any number of children so we have a grandparent, parents and children realtionship going on.
basically i have the nav for each grandparent being display which shows all of the parent and children for that section like so:
{% show_menu_below_id request.current_page.reverse_id %}
the problem i have is as i navigate the menu obviously starts changing to show the items below that pages id. I only want to ever show the menu for grandparent sections not the other pages as i navigate through the site
i have 3 templates one for the grandparents one for the parents and one for the children. I hope this is clear enough to explain my problem. just to re-iterate no matter how far i go down through the sub menu i need to only the menu as if i was at the top level of the section IE the grad parent page
Thanks in advance
I'm not 100% sure I understood what you want. Are the "grandparent" pages at the root? If so, I think this should do the trick:
{% show_menu 1 %}
It displays the navigation from the first level (level 0 is the root- or "grandparent"-level). The docs go into more details on how to use the show_menu
tag (it's not exactly intuitive...)
Why not just have the whole thing expanded, then on the relevant pages you could get a bit cheeky and use CSS to hide the lower levels that you wanted hidden.
There are enough classes and stuff being applied by default that you could probably target the relevant areas.
Obviously it's not ideal, but it's probably about as close as I could get.
精彩评论