Hi Gerard, sorry but I don't understand your setup. Could you show us some sample code which does the actual navigation list?
Thank you very much for your time On Tue, Sep 30, 2008 at 1:53 PM, Gerard Petersen <[EMAIL PROTECTED]> wrote: > > Hi All, > > I don't understand why it's needs to be so complicated. When using a 'double' > template inheritance, e.g: base > base_products > product_add > > There's only one place where you have to maintain some navlist html/css code. > This is where the 'active' attribute is maintained. So with multiple sections > like: product, customer, invoices youre hierarchy looks like this: > > base.html > base_product.html (extends base.html) > product_add.html (extends base_product.html) > > base_customer.html > etc ... > > base_invoice.html > etc ... > > > This comes straight from the docs: > http://docs.djangoproject.com/en/dev/topics/templates/#id1 > (See 'base_SECTIONNAME.html' about two screens down from there) > > I personally dont' see the needs for loops and extra code. Or is my app to > simple ... :-) > > Regards, > > Gerard. > > Steven Armstrong wrote: >> Alex Rades wrote on 09/30/08 09:03: >>> Hi, >>> what kind of pattern do you use to add a class attribute to the >>> current page being viewed? >>> I mean the usual: >>> >>> <ul id="navlist"> >>> <li><a href="index.html" class="current_active">Home</a></li> >>> <li><a href="products.html">Products</a></li> >>> <li><a href="faq.html">FAQ</a></li> >>> <li><a href="contact.html">contact us</a></li> >>> </ul> >>> >>> I have this snipped of html defined in the base template and all pages >>> inherit from it. >>> Currently I'm using this templatetag: >>> >>> http://gnuvince.wordpress.com/2007/09/14/a-django-template-tag-for-the-current-active-page/ >>> >>> while it's very useful, I don't like it too much, so I'm asking you >>> what is the best practice here. >>> >> >> I usually do that through a css switch on the body tag. >> e.g. >> >> base template: ----- >> <body id="section-{% block section %}home{% endblock %}"> >> <ul id="navlist"> >> <li id="nav-home"><a href="index.html">Home</a></li> >> <li id="nav-products"><a href="products.html">Products</a></li> >> <li id="nav-faq"><a href="faq.html">FAQ</a></li> >> <li id="nav-contact"><a href="contact.html">contact us</a></li> >> </ul> >> </body> >> >> >> css: ----- >> #section-home #nav-home a, >> #section-products #nav-products a, >> #section-faq #nav-faq a, >> #section-contact #nav-contact a { >> background-color: blue; >> } >> >> >> products template: ----- >> {% block section %}products{% endblock %} >> >> >> faq template: ----- >> {% block section %}faq{% endblock %} >> >> >> hth >> Cheers >> Steven >> >> > > > -- > urls = { 'fun': 'www.zonderbroodje.nl', 'tech': 'www.gp-net.nl' } > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---