Dotiac::DTL::Tag::extends - The {% extends FILE %} tag
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 %}
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.
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:
<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 %}
http://www.djangoproject.com, Dotiac::DTL
Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.
Marc-Sebastian Lucksch
perl@marc-s.de
To install Dotiac::DTL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dotiac::DTL
CPAN shell
perl -MCPAN -e shell install Dotiac::DTL
For more information on module installation, please visit the detailed CPAN module installation guide.