Template Syntax


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>


<include name type=typename>

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.

Other files can be included as well. If you need to include a file that shouldn't be or doesn't need to be compiled by the FM-Classic parser, these can be included as follows:

<include "foo-files/file-to-include.inc" type="unparsed">

The type parameter is also an expression. In previous releases, a semicolon between the two arguments was required. In this release, it is optional.