Hi Dan,
> make a view for the nav.html template (which is included in all the
> page templates)? I imagine it could be done with SSI but I don't want
> to go that route unless I have no other option.
Carole's advice solves your problem just right; on the other hand, you
might want to look at the
On Jul 28, 1:33 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Yeah I was going to post a sample if that's what he said next :) Here
> is another sample in addition to the link above .. on how to pass the
> menu code via context processors:
That works great! Thanks a bundle Carole!
--~--
Hi,
> Oh, I do that, but it still requires setting the variable "menu" in
> every single view based on that template.
You may want to check out Jinja [1], a templating engine very close to
the Django one, which enables to set variables in the template. It's
not very much advertised here, but it'
On Jul 28, 12:30 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Why not have a base template that contains the menu variable ( I put
> mine in a session variable accessible to the templates named menu ),
> then have all of your other templates extend from that template?
Oh, I do that, but i
Yeah I was going to post a sample if that's what he said next :) Here
is another sample in addition to the link above .. on how to pass the
menu code via context processors:
In your settings.py file ...
Find the line that says (there may be more in there depending on your
setup):
TEMPLATE_CONTEX
I could be wrong, but I think the problem he's having is having to
specify the menu variable in the context for every view, not the
template end of it...
To fix that, you will want to check out context processors:
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-re
Why not have a base template that contains the menu variable ( I put
mine in a session variable accessible to the templates named menu ),
then have all of your other templates extend from that template?
In base.html:
your header code
{% block menu %}
{{ menu }}
{% endblo
I've got a nav.html template that does the menu on every page. The
only trouble is I have to store the menu items in a global variable
and pass it to the page template in every view. Is there any way to
make a view for the nav.html template (which is included in all the
page templates)? I imagine
8 matches
Mail list logo