On Wednesday 16 Nov 2005 8:26 pm, stava wrote:
> Hi all,
>
> does anyone now how to use the {% block nav-global %} tag in
> admin/base_site.html? I'm looking to get a nice main menu bar kinda'
> thing like on the django site, but I'm not experienced (clever)
> enough to figure it out.
this is what i do: in views:
menu_items = [
{'name':'Home','url':'','id':''},
{'name':'Accomodation','url':'fac/AC/','id':''},
{'name':'Activities','url':'fac/AT/','id':''}]
def makemenu(item):
l = menu_items
for k in l:
k['id'] = ''
if k['name'] == item:
k['id'] = """ id="current" """
return l
def index(request):
t = template_loader.get_template('bamboos/index')
c = Context(request,
{
'mn': makemenu('Home'),
})
and in my base template:
<div id="navsite">
<h5>Site Navigation</h5>
<ul>
{% block navsite %}
{% for p in mn %}
<li >
<a href = "/mysite/{{ p.url }}" {{ p.id }}> {{ p.name }}
</a>
</li>
{% endfor %}
{% endblock %}
</ul>
</div>
this generates the menu and marks the correct current menu
--
regards
kg
http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!