NAME
Dotiac::DTL::Tag::extends - The {% extends FILE %} tag
SYNOPSIS
Template file:
{% extends "main.html" %}
{% block title %}About us{% endblock %}
{% block pagecontent %}<h1>About us</h1>Under construction{% endblock %}
Other template file:
{% extends variable %}
This text will never be printed, ever.
{% block pagecontent %}<h1>Main Page</h1>Under construction{% endblock %}
DESCRIPTION
Loads another template and replaces its content with this.
The content will be ignored, unless {% block %} tags, which are evaluated. Those will replace the corresponding {% block %} tags in the included template. See Dotiac::DTL::Tag::block for details
The FILE parameter can be either a string: "file.html" or a variable. If it is a string, the template will be loaded and parsed during the parse time of the template, which is faster. A variable can be either a filename or a Dotiac::DTL object.
BUGS AND DIFFERENCES TO DJANGO
Django's {% extend %} works for the whole files and ends at the file end. In this Dotiac::DTL, this is also valid and works as you would expect:
Template file:
<html><body>
{% extends "sidebar.html" %}
{% block sidebartext1 %}Great news{% endblock %}
{% block sidebartext2 %}Dotiac::DTL finished{% endblock %}
{% endextends %}
<div id="page">
Page content
</div>
{% extends "footer.html" %}
{% block foottext %}Author: me{% endblock foo %}
{% endextends %}
</body></html>
Most tags update blocks even if they shouldn't, this is why this won't work as you expect.
Django doesn't allow this anyway. This will always set the "content"-block to "No Text" no matter what var is.
{% extends "foo.html" %}
{% if var %}
{% block content %}
Text
{% endblock content %}
{% else %}
{% block content %}
No Text
{% endblock content %}
{% endif %}
SEE ALSO
http://www.djangoproject.com, Dotiac::DTL
LEGAL
Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.
AUTHOR
Marc-Sebastian Lucksch
perl@marc-s.de