Usage
There are two ways to use In: Insert and Include.
Insert
Inserts a template as an early-parsed global variable or snippet.
Example
Instructions
Notice that there is not an exp:
at the beginning of the tag. Just remember to specify the template that you would like to parse. In the example above, the blog/.blog_entries
template would be inserted.
Parameters
Unlike the Include tag, this tag does not accept any parameters.
Advantages
This tag conveniently allows you to use any template file as if it were a snippet. This is great for version control, and can greatly reduce the number of (slow) embeds needed to build a site. Additionally, inserting templates this way has very little overhead.
Include
Includes a template file. It's basically an embed that is parsed as an exp tag, instead of much later in the parse order.
Example
Instructions
The most important thing is to specify which template to include. In the above example, the includes/.header
template is included. Notice that the template is passed in as part of the tag itself, and not as a separate parameter.
Parameters
Like EE embeds, you can (optionally) pass in multiple parameters of your choice. The above example passes in a default_description
and a default_keywords
parameter. These parameters' values are then available in the template itself using the standard embed variable syntax: {embed:default_description} {embed:home_meta_keywords}
Advantages
Native EE embeds are parsed very late in the parsing order, well after all of the {exp...} tags are parsed. This tag causes the templates to be parsed much earlier, allowing the included template's content to be used in conjunction with other exp tags. It is also lighter than parsing a full embed (but heavier than using the Insert method).
Hat tip: The include functionality is based on the Pre Embed add-on by @_rsan.