Installation
Just do as you normally do when installing add-ons in ExpressionEngine 2:
- Extract the .zip file
- Move the
/system/expressionengine/third_party/republic_variablesfolder into your ExpressionEngine installation’s/system/expressionengine/third_party/folder. - Move the
/themes/third_party/republic_variablesfolder into your ExpressionEngine installation’s/themes/third_party/folder. - Activate the module in the Control Panel
- Go to Add-ons > Modules > Republic Variables
Documentation
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.
The main purpose is to have one place for everything that doesn’t naturally fit in channels. Examples include short phrases, footer information, wording in forms, etc. The variables can also be organized into groups.
Fig 1. Variable groups with variables
Another purpose 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.
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. To edit the value inline in this view, just click the on the value.
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: the default variable, the English variable, the German variable, and the Swedish variable:
Fig 3. Default variable and three languages
The different variables can then be used in the templates with the chosen prefix like this:
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 variable table with only the specific language variables (English, German and Swedish in this example):
Fig 4. Only the three created languages
This also makes it possible to use {{language}-variablename} in the templates if you have a {language} variable set.
Extension
There is also 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. I.e., this way {de-variabelname} would output {en-variablename} if English is the default language and the {de-variablename} value is empty.
Sometimes this is exactly what you want, and sometimes you rather have the variable empty.
Configuration
You can easily customize the add-on. Here are the major things that can be tweaked:
- Member groups allowed to change the add-on’s configuration
- Show the default variable or not when using multiple languages
- Expand or collapse groups by default
- Show variable data as text or use an image to indicate empty or not (useful when having a lot of languages)
- Define a default language
- In templates, fall back on the default language if the current language variable is empty
- Create groups only visible for Super Admins
Download
Download “Republic Variables” for ExpressionEngine 2.2+
Changelog
-
1.5
2011-11-25
- Stable release
-
1.4b
2011-11-04
- Feature: MSM support
- Fixed: Rewrote delete function for groups and languages
- Fixed: "Minor" bugfixes
-
1.3b
2011-10-28
- First Public Beta release.
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.