The goal of this page is to give a workaround such that is possible to access the menu of the top-level page. I have created the file "cms_navigation_extra.py" in the templatetags directory with following code:
from django import template
from django.conf import settings
from django.utils.html import escape
from django.utils.translation import get_language
from cms.models import Page
from cms.cms_global_settings import *
register = template.Library()
class CmsFrontPageNavigation(template.Node):
def __init__(self, varname):
self.varname = varname
def render(self, context):
pages = Page.objects.filter(parent__isnull=True,in_navigation=True)
pages = Page.objects.filter(parent=pages[0], in_navigation=True)
context[self.varname] = pages
return ''
def cms_frontpage_navigation(parser, token):
tokens = token.contents.split()
if len(tokens) != 3:
raise template.TemplateSyntaxError, "'%s' tag requires two arguments" % tokens[0]
if tokens[1] != 'as':
raise template.TemplateSyntaxError, "First argument to '%s' tag must be 'as'" % tokens[0]
return CmsFrontPageNavigation(tokens[2])
cms_frontpage_navigation = register.tag(cms_frontpage_navigation)
On the template site following implementation is used:
{% load cms_navigation_extra %}
{% cms_frontpage_navigation as nav %}
<ul id="bottom_menu">
{% for mainpage in nav %}
<li><a class="{% if page %}{% if_cms_is_subpage page mainpage %}menu_active{% end_if_cms_is_subpage %}{% endif %}"
href="{% cms_link mainpage %}">{{ mainpage.title|escape }}</a></li>{% endfor %}
</ul>
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)