{include} {#language.function.include} ========= `{include}` tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template. - The `{include}` tag must have the `file` attribute which contains the template resource path. - Setting the optional `assign` attribute specifies the template variable that the output of `{include}` is assigned to, instead of being displayed. Similar to [`{assign}`](#language.function.assign). - Variables can be passed to included templates as [attributes](#language.syntax.attributes). Any variables explicitly passed to an included template are only available within the scope of the included file. Attribute variables override current template variables, in the case when they are named the same. - You can use all variables from the including template inside the included template. But changes to variables or new created variables inside the included template have local scope and are not visible inside the including template after the `{include}` statement. This default behaviour can be changed for all variables assigned in the included template by using the scope attribute at the `{include}` statement or for individual variables by using the scope attribute at the [`{assign}`](#language.function.assign) statement. The later is useful to return values from the included template to the including template. - Use the syntax for [template resources](#resources) to `{include}` files outside of the [`$template_dir`](#variable.template.dir) directory. **Attributes:** Attribute Name Type Required Default Description ----------------- ---------------- ---------- --------- -------------------------------------------------------------------------------------------------- file string Yes *n/a* The name of the template file to include assign string No *n/a* The name of the variable that the output of include will be assigned to cache\_lifetime integer No *n/a* Enable caching of this subtemplate with an individual cache lifetime compile\_id string/integer No *n/a* Compile this subtemplate with an individual compile\_id cache\_id string/integer No *n/a* Enable caching of this subtemplate with an individual cache\_id scope string No *n/a* Define the scope of all in the subtemplate assigned variables: \'parent\',\'root\' or \'global\' \[var \...\] \[var type\] No *n/a* variable to pass local to template **Option Flags:** Name Description --------- ------------------------------------------------------------------------------------- nocache Disables caching of this subtemplate caching Enable caching of this subtemplate inline If set merge the compile code of the subtemplate into the compiled calling template