If by config variables, you mean the ones on config.php
, it's pretty easy to do.
On your config.php
add the following code:
global $assign_to_config;
if(!isset($assign_to_config['global_vars']))
$assign_to_config['global_vars'] = array();
Now, you can create early parsed template variables.
Let's say you set the mail protocol used by a System Config Override:
$config['mail_protocol'] = 'sendmail';
If you need to access this info on templates, you need to create a template variable:
$config['mail_protocol'] =
$assign_to_config['global_vars']['cv-mail_protocol'] = 'sendmail';
On templates, you can use {cv-mail_protocol}
:
{if cv-mail_protocol == 'sendmail'}
The emails are being send by SendMail
{/if}
You can use a PHP conditional too to set them:
if ($_SERVER['HTTP_HOST'] == 'www.domain.com')
These variables are parsed even before Preload Text Replacements, which gives you a lot of flexibility.
{if cv-language == "en"}
{preload_replace:pr-name_label="Name"}
{preload_replace:pr-tel_label="Phone number"}
[...]
{/if}
<label for="name">{pr-name_label}
<input type="text" id="name" name="required[]" size="50" />
</label>
[...]