Republic Variables hooks into ExpressionEngine’s Global Variables and give you an easy way to view, organize and edit all the variables you use on the site in one place. Now also ready for ExpressionEngine 3.1+.

Global Variables makes it possible to have one place for everything that doesn’t naturally fit in channels. Examples include short phrases, footer information, wording in forms, etc. ExpressionEngine has native support for Global Variables but we felt that it could use a little bit of polish to really shine.

Another purpose with Republic Variables is to help the content editor get a better overview of all the variables used, especially when working with multiple languages. The built in multi language support makes it easy to first add languages, and then add variables which automatically is created for all the different languages.

Variable groups with variables Fig 1. Variable groups with variables

With Republic Variables you can, amongst other things:

Simple example

In it’s simplest form, Republic Variables can be seen as an alternative way to create and edit ExpressionEngine’s Global Variables. Use Add Variable to enter a name, an optional description and a value. After this they appear under Variables.

One single variable Fig 2. A single variable

If you create a variable with the name variablename, you can then use this in your templates to display the current value – just like a Global Variable:

The value of the variable is {variablename}.

When you have more then a few variables it might be handy to group related variables together. To do this just click on Add Group and give it a name.

Multi-language example

We think that this add-on really shines when used on sites with multi-language content. To start using Republic Variables in multi-language mode, go to Add Language and enter a name and a prefix (or postfix if you rather use that).

Let’s say that you create a couple of languages (i.e. English, German and Swedish) with the prefixes en-, de- and se-. This will make the add-on create four versions of every variable:

Default variable and three languages Fig 3. Default variable and three languages

The different language versions can then be used in the templates by combining the language prefix (or postfix) and the variable name:

Default value: {variablename}
English value: {en-variablename}
German value: {de-variablename}
Swedish value: {se-variablename}

If you like to use it for multi-language sites you have the option, amongst others, to hide the default variable under Configuration. This results in a table with only the specific language variables (English, German and Swedish in this example):

Only the three languages Fig 4. Only the three created languages

The best way to use multi-language variables is to define a language specific variable in your index.php or config.php file for each language and then use that in the templates. Lets say we have defined a variable called language for each of the languages which matches the prefix we set up earlier. Then, in your templates, you could just use {{language}-variablename} to display the right version of the variable on each site.

Optional fallback variables

The add-on also includes an extension which lets you decide if you want to fall back on the default language if there’s no value defined for the current variable. This way {de-variabelname} would output {en-variablename} if English is the default language and the {de-variablename} value is empty in Republic Variables.

Sometimes this is exactly what you want, and sometimes you rather have the variable return the empty string.

Save variables to template files (EE2)

We also added the option to save variables as files. This will give you the ability to edit variables in your text editor and gives you the ability to version control them if you so desire. Running EE3 all ready? Great news. EllisLab built in support to save your Global Variables as file right out of the box.

For some most content this makes no sense, but for other content this is very handy. You could for instance create a specific variable group, only accessible by Super Admins, and keep things you normally would use an embed for. Combine this with the ability to parse these variables early you can also get a pretty nice performance increase and, at the same time, work with your global variables in a text editor as you do with other templates.

Add version control and you can easily push your changes to the dev and live server without the need to do a database dump. Nice!

Note: Just make sure you create the variables via Republic Variables on all sites in the first place, and enable ”Save variable to template file”, so ExpressionEngine is aware of that the variable exists. This is after all just native Global Variables in another costume…


If you decide to save some variables to files you’ll probably appreciate the option to sync the files with the database before importing your variables to a new MSM site since the import function only import the Global Variables saved in the database.

The Sync options can be found under ”Configuration”.


The improved MSM support includes an option to import variables from one site to another. The new version also let you import your languages and groups, so now it’s a breeze to set up your variables in another MSM site.

Already defined Global Variables can also be imported into Republic Variables with ease now when you start using the add-on. Just create the languages and set up the correct prefix or postfix and Republic Variables will automatically import your already defined language specific variables in the right language columns.


You can easily customize the add-on. Here are the major things that can be tweaked on the Configuration tab:


Just do as you normally do when installing add-ons in ExpressionEngine:

ExpressionEngine 3

ExpressionEngine 2


Just replace the old files with the new ones:

ExpressionEngine 3

ExpressionEngine 2


Download “Republic Variables (EE2/EE3)” for ExpressionEngine 2.2+


License and disclaimer

Republic Factory gives this add-on away for free under a Creative Commons Attribution-NoDerivs 3.0 Unported License. You can use it for free, both in personal and commercial projects, but by downloading this add-on you also take full responsibility for anything that happens while using it. The add-ons are made with love and passion, and are used by us on daily basis, but we cannot guarantee that it works equally well for you.

Support is limited depending on current work load, but if you got any questions or comments feel free to email or follow us on Twitter @republicfactory and we'll try to help you out as soon as time permits.

To top ↑

← Back to ExpressionEngine Add-ons