How can we help?

Reusable HTML content overview


The HTML content feature allows you to store HTML or Smarty content that can be inserted into any template using a tag. You may also see HTML content referred to as "includes". This is useful for common blocks of branded content such as headers or footers that will often be the same across many templates.

HTML content includes are compiled and rendered in a message at time of send or in message preview.

Call HTML content

You can call HTML content into any template using the following tag:

{include 'content:contentKey'}

Replace "contentKey" with the key name you gave the content in the system. For example: Let's assume you have two blocks of content; "Header" with the key = "header1" and "Footer" with the key = "footer1".

You may include more than one block of HTML content:

{include 'content:header1'}
  Unique body content for this template here
{include 'content:footer1'}

The include is useful when you have many templates referencing the same centralized HTML content. Any edits to the content within the include will cascade across all templates where that content is included.

Use the scope parameter

If you define Smarty variables in an include, and wish to render them in the message template, you will need to use the scope parameter. Setting the scope parameter to parent will place the HTML content include at the top of the template hierarchy, making it accessible to subsequent variables and functions.

Additionally, we assign the HTML output to a variable called "blackhole." This variable is never used, which means we will not use the HTML output of the include, only the $data variable that's built up.

Example where the variable is defined in the HTML content

HTML content with a key of "header":

{$greeting = "Hello World"}

Message template that includes the HTML content:

{include 'content:header' scope='parent' assign='blackhole'}

Rendered output:

Hello world




Please sign in to leave a comment.