Download EE 2 Docs Download EE 1 Docs

2.9.2 User Guide

User-Defined Global Variables

Control Panel Location: Design ‣ Templates ‣ Global Variables

Custom, user-defined global variables can be created for use in any Template.

User-defined global variables can hold any static information. These variables can be useful for things like site header, footers, copyright notices, etc. Since these variables can go in any template it makes the information very portable and simple to update.

Once you’ve created a variable you can use it in any template simply by surrounding the variable name with curly braces. For example, if you create a variable called “copyright”, you’ll use it in your template this way:


Important: You cannot give a user-defined global variable the same name as an existing variable. This includes variables native to ExpressionEngine such as other Global Variables. Please see the list of Reserved Words for details.


User-defined global variables are not run through the template engine, so you cannot place EE Tags, PHP, or variables inside them. Also note that Global Variables are one of the last things parsed in your Templates. This means that you cannot use a Global Variable as the value for an EE Tag parameter. For instance, if you had a Global Variable called “special_channel”, the following would not work

{exp:channel:entries channel="{special_channel}" limit="10"}

In this case, you would need to consider using a Snippet.

User Contributed Notes

Posted by: Hop Studios on 28 October 2011 1:06am
Hop Studios's avatar

If you want to store or edit these variables outside of the EE control panel, you can put them in the index.php file like this:

$assign_to_config['global_vars'= array(
'copyright' => 'Copyright 2011 Hop Studios',
'ttfn'  => 'Ta Ta For Now'


You must have an EllisLab product license and have at least 50 posts to the community forums to contribute notes to the User Guide