Adding Custom Variables
To meet the specific needs of your business, you can create custom variables and insert them into pages, blocks and email templates. The list of allowed variables that appears when you click the Insert Variable button includes both predefined and custom variables. As shown in the following image, the list of available variables for a specific email template is determined by the data that is associated with the template. See the Variable Reference for a list of frequently-used email templates and their associated variables.
Only allowed predefined or custom variables can be used in email and newsletter templates.
Step 1: Create a custom variable
-
On the Admin sidebar, go to System > Other Settings > Custom Variables.
-
Click Add New Variable.
Custom Variables
-
Enter an identifier for Variable Code, using all lowercase characters without spaces.
If needed, you can use an underscore character or hyphen to represent a space. For example:
my_custom_variable
-
Enter a Variable Name, which is used for internal reference. For example:
My Custom Variable
-
To enter the value that is associated with the variable, do one of the following:
- For Variable HTML Value, enter the variable value formatted with simple HTML tags. For example:
<b>This formatted content appears in place of the variable.</b>
- For Variable Plain Value, enter the variable value as plain text without formatting. For example:
This unformatted content appears in place of the variable.
If you need more room, drag the lower-right corner of the text box.
New Custom Variable
- For Variable HTML Value, enter the variable value formatted with simple HTML tags. For example:
-
When complete, click Save.
Step 2: Insert the custom variable
Example - insert a variable into a page
-
Open the CMS page or block where the variable is to appear.
-
Expand the Content section. Then, click Show / Hide Editor to work in HTML.
-
Position the insertion point in the editor where you want the variable to appear and click Insert Variable.
-
Select the option for the custom variable that you want to insert and click Insert Variable.
Select Custom Variable
A command to insert the variable is enclosed in curly braces and added to the code at the cursor location. For example:
customVar code=my_custom_variable
Custom Variable Code
-
When complete, click Save.
Example - use Page Builder to insert a custom variable
-
Open the page or block where the variable is to appear.
-
Expand the Content section.
-
In the left panel, click Elements and do one of the following:
-
Click in an existing text area where you want to insert the variable.
-
Drag a new Text object to the stage.
-
-
At the far right of the editor toolbar, click () to insert a variable.
PageBuilder Stage and Panel
-
In the list, select the custom variable that you want to insert and click Insert Variable.
Select Custom Variable
The variable identifier appears as a placeholder in the editor.
Variable Placeholder
-
When complete, click Save.