Development Guides Home >> Guide to Template Toolkit
Guide to Template Toolkit - Includes
Introduction
Includes allow you to standardize the appearance of Template Toolkit files.
Includes
You can use the include
function to include template files in other template files. This allows you to standardize the content of a set of files with similar headers, footers, or other features.
For example, you could create a standard footer file to include in all of your files. To do this, create the footer.html
file, and then add the following code to the other files:
[% PROCESS 'footer.html' -%]
Each file now displays the footer.html
file within the template.
The file path for an include is relative to the directory of the file that calls the included file. If you wish to organize your includes into the include
subdirectory, call the include with the following code:
[% PROCESS 'includes/footer.html' -%]
Each file now displays the includes/footer.html
file within the template.