Template Syntax
Includes



If you're using a TemplateCache (described here) to store your templates, you can include a template inside another template, using this syntax:

<include name>

The name is an expression whose string value is the unique name of the template in the cache. For example, if you're using a FileTemplateCache:

<include "foo-templates/template-to-include.html">

The output from the included template is inserted at the point where the include statement occurs. The included template uses the including template's data model; any assignments made in the included template therefore remain in effect in the including template. Functions defined in either template can be called in the other template. This makes an included template a convenient place to put constants and functions used on several pages.

Since include statements are processed at run time, they should occur above any references to included variables or functions.

Previous: Functions Next: Compressing Whitespace