Cole Tuininga wrote:
> Fair enough.  Is there a better way to accomplish this?  I'd much
> prefer to have the title defined within the template rather than
> having to pass it in as a variable from the view...

I think you just have to think about it the other way around.  Instead
of each template including bits of other templates you have a base
template that defines all the bits, and each template extends from the
base and specifies what each of the bits are (or doesn't specify them
if you want the default).

So you original example might be something like this:

<html>
<head>
{% block head %}
<!-- some default stuff to overwrite in subtemplates here -->
{% endblock %}
</head>
<body>
<div id="header">{% block header %}{% endblock %}</div>
<div id="menu">{% block menu %}{% endblock %}</div>
<div id="content">{% block content %}{% endblock %}</div>
</body>
</html>

I'm even adding things like this:

<body{% block extra_body %}{% endblock %}>

So if I want or need to add a declaration to body in a subtemplate, I
add an extra block with its content.  And if I don't, I get a plain
body tag.

-Rob


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to