Global Variables
Global Variables are still in "beta"; It works but some parts in the backoffice don't have the final design. Unless told to use them, please wait, the feature is still in progress.
CMS variables are scoped only inside their block (or list/page), you can not access them from another block.
Each global variable also has a category (you can create as many as you want), that will allow organizing variables by "goal"
Example 1 - Showing prices
For example, if you want an option to show/hide prices everywhere on the website, you could do:
{if=" '#$global|settings|show-prices$#' "}
<!-- your code here -->
{/if}
#$global|settings|show-prices$#
is a global variable with the key "show-prices" in the category "settings"
settings
: the category keyshow-prices
: the variable key
Example 2 - Map default zoom
For example, if you want a default zoom for the maps everywhere on the website, you could do:
{if=" '#$global|map|default-zoom$#' "}
<!-- your code here -->
{/if}
#$global|map|default-zoom$#
is a global variable with the key "default-zoom" in the category "map"
map
: the category keydefault-zoom
: the variable key
The combination of the category and the key creates a unique identifier for your variable (so if you change the category key, it is a new variable)
Edit value in the backoffice
To edit your variable go to your website, sidebar > Settings > Global Variables
The section is still a work in progress:
permissions are not defined yet, only some users have access to it
you can only "simple" input fields (no switch, etc.)

Code
Here is the syntax: #$global|category|variable-key$#
#$global|settings|show-prices$#
<!-- category: settings; key: show-prices -->
#$global|map|default-zoom$#
<!-- category: map; key: show-prices -->
You can create categories, they are defined at the theme level
Edit variable configuration
The documentation is only here to give some context. As the feature is still in beta, if you need to use it, we will provide you with the exact file names and contents to use
It is not yet possible to edit the variable configuration in Testeur, you have to do it manually with a .data file inside the code
Categories label can not be customized for now (so the name visible in the BO will be the key)
You can only use "simple input" variables for now
Last updated