Using SystemConfig

$SystemConfig is a global variable in SCHLIX CMS that is used to get/set configuration value for application.

A. Retrieving configuration value

To retrieve a configuration value, simply call $SystemConfig->get('your_application_name','prefix_and_config_key');

For example:

$is_log_enabled = $SystemConfig->get('users', 'bool_enable_logging);
$timeout = $SystemConfig->get('emailqueue','int_smtp_timeout');

In your class, you can also specify $this->getConfig('config_key_name');. For simplicity sake, it is highly recommended to use this method instead of calling $SystemConfig directly. The only time you call $SystemConfig directly is when you need to find out the configuration value for another application.

This is also the same case with block and macro, which uses different tables. The value is automatically typecasted into one of the following data type: boolean, int, double, float, string, array.

B. Setting configuration value.

To set a configuration value, simple call $SystemConfig->get('your_application_name','prefix_and_config_key');

You can also set the value by calling $this->setConfig('config_key_name','value'); in your application class.

C. Blocks and Macros configuration

To retrieve a configuration value in a block or a macro class, simply get the value from $this->config['config_key']. Unlike application, blocks and macros don't have the ability to set the configuration value directly from within its class.