Hi,

I'm having a problem with the template {% include .. %} tags. I'm using
the svn trunk. Here's a simplified version of what I'm trying to do:

base.html
-------------
<!DOCTYPE ...>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
...
<style type="text/css">
        (basic common css)
        {% block extra_css %}{% endblock %}
</style>
{% block jscript %}{% endblock %}
</head>
<body>
        <h1>{% block title %}{% endblock %}</h1>
        {% block content %}{% endblock %}
</body>
</html>


login.html
-------------
{% extends "base.html" %}
{% include "snippets/jscript-loginvalidation" %}
{% include "snippets/centercss" %}

{% block title %}Authentication{% endblock %}
{% block content %}
<form ...>
...
</form>
{% endblock %}


snippets/centercss
-------------------------
{% block extra_css %}
body { text-align: center; }
table.center {
        margin-left: auto;
        margin-right: auto;
}
{% endblock %}


However, this is not working as I would have expected. It seems that
the "include" tag only works inside a "block" tag. This is not explicit
in the documentation.

I think it would make much more sense for {% include .. %} to work like
a preprocessor which would simply include the contents of the included
template inside the "main" template (kind of like the #include
preprocessor instruction in C).

Is there a fundamental reason why this shouldn't work like that?


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