stevedegrace wrote: > Variables you bind within the template itself don't seem to behave > this way. > > Instead they are scoped. If a variable is bound inside a block tag, > the binding is only valid within that block. I didn't do enough > experiments yet to tell you how it behaves with nested blocks. >
I rely on scoping for my templated menus - I do the following in child templates to mark a menu item current - In projects_base.html.djt, say: {% extends "base.html.djt" %} {% block menubar0_projects %} {% with 1 as current %} {{ block.super }} {% endwith %} {% endblock %} So,it's effectively like the content of the menubar0_projects block in base.html.djt getting a variable "current" defined. This allows me to keep all my menu definitions in one template, rather than just overriding the block wholesale. I'm a django newbie, maybe there was some other way to do it, but it works fine. --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---