Processes a partial template. Any variables in the parent template will be available in the partial template. Variables set from the partial template using the set or assign tags will be available in the parent template.
If the partial template is a compiled template, then any custom fields from the partial template will be available in the parent template as well.
{% include [type] input [variable1: value] [variable2: value] [etc...] %}
type: Optional. May either be javascript, stylesheet, or template. If not specified, the object to be included will be determined by the type of the current object (in a template this will default to template, etc...).
input: Can either be a string or a variable. Note that objects included from variables are not "compiled templates" and therefore any custom fields defined in them will not be available from the parent template. If input is a string, the object to be included will be dependent on both the current and target template's path. More on that below.
variables: Include variables for assignment in the {% include %} tag. This is identicial to calling {% var %} on the variables inside the template except that you cannot use filters in the include tag variable assignment. You can even assign varaibles by reference.
The include tag creates a new child scope.
The path is significant when including objects. Every template, javascript, and stylesheet has a path, even if that is the root path (/). The location of the path to be included will always be based off of the path of the current object. So including 'header' from a template at the path '/pages' will attempt to process '/pages/header' while the same include from a template at the root path - which would attempt to process '/header'.
You always have the option of using an "absolute path" when including templates by beginning your included template name with '/'. Eg: {% include '/header' %} or {% include '/partials/header' %}. Absolute paths ignore the path of the current template when determining what partial to include.
You can also navigate up the directory structure using '../'. So including '../partials/header' from a template at the path '/agency/pages' will attempt to process '/agency/partials/header'.
Include partial by string
CopyDynamically Include Template
CopyInclude template and pass variables
CopyInline javscript from template
Copy