Retired Documentation:  You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.

Embedding Templates within Other Templates

Any template can be embedded within another template using the "embed" variable:

{embed="template_group/template"}

Where "template_group" is the name of the group and "template" is the name of the template. For example:

{embed="site/header"}

You must include both the template group and the template name in the embedded tag.

By default, you cannot use embeds inside of the Forum Module or in the Membership Templates.

Embed Variables for the Embedded Template

In the {embed=""} tag you can also specify parameters that will be used as variables in the embedded page. For example, if you specifiy a parameter of dog_name="Shadow":

{embed="site/header" dog_name="Shadow"}

Then in the site/header template, you can have a variable called {embed:dog_name}, which will be replaced with the value of "Shadow":

<h2>My dog's name is {embed:dog_name}</h2>

Since {embed=""} tags are processed after all of the other tags of the original template are processed, this means you can set these parameters with other variables too:

{exp:weblog:entries weblog="default_site" limit="1"}
{embed="site/export" the_id="{entry_id}"}
{/exp:weblog:entries}

You may also use embed variables in conditionals:

{if embed:dog_name == "Shadow"}
My dog's name is {embed:dog_name}.
{if:else}
{embed:dog_name} will never be as cool as Shadow.
{/if}

Notes

Top of Page