Adding a Global Variable


Administrators often want to manage a set of terms that gets used in a predefined way throughout a site. These could be industry-specific terms that change sporadically or brand names that might change because of impending mergers or acquisitions. To do this, administrators can set a global variable.

Management of global variables is controlled at Administration > System Options > Dynamic Site Server > Global Variables.

Global variables can be set generically across all publishing targets in the CMS, or they can be set specifically for each publishing target. This gives administrators the ability to update these terms at a precise scope. This is especially helpful for when similar sites need to be produced on a regional or brand-specific basis, where the majority of the site is the same at two different URLs, but certain terms change within the content.

Static global variables

To set a variable, click the plus button and select Add global variable with static value. (The second option, Add global variable with dynamic XPath query, is covered below.) First enter the Variable Name, which is what is chosen by users to insert the variable into their content. This shouldn't include any spaces or special characters. If a Value is set, this will be the default value, in the event that a value is not set for a specific publishing target.

Click the + button to add publishing target-specific values. These could be used for different websites being produced from the same content, or to test new values for a staging versus live site publish.

When you're finished editing global variables, click Save

Dynamic global variables

Administrators also have the option of assigning a global variable's value through an XPath query rather than hard coding it. This makes the global variable dynamic rather than static.

For example, consider a site whose site control contains a field called ClientName. By creating a global variable ClientName and assigning it an XPath value of /*/ClientName, the variable is dynamically updated in a page's body copy to reflect the current value of the ClientName field in the site control.

To add a dynamic global variable, click the + button and select Add global variable with dynamic XPath query.

Type a name for the variable. Then, in the Page Content XPath Query field, type the XPath query that locates the variable. As with static global variables, you can configure publishing target-specific values if desired. 

When you're finished creating the dynamic global variable, click Save.