18 January, 2010

Extending Base Templates

{% extends "_base.htm" %}
{% block bodycontent %}
<h2>App Engine: About</h2>
<p>
Welcome to the site dedicated to
learning Google App Engine.
We hope you find www.appenginelearn.com useful.
</p>
{% endblock %}

The template language uses curly braces and percent signs to indicate our commands to the render engine. The first line says this page starts with the text contained in the file _base.htm. We are starting with _base.htm and then extending it.
The second line says, “When you find an area marked as the bodycontent block in the _base.htm file, replace that block with the text in between the block and endblock template commands.”

The _base.htm file is placed in the templates directory, along with all the rest of the template files.

No comments: