Config


Configuration files can be loaded and config variables displayed via this library.

It is worth noting that Outlast Framework handles configuration and language variables as the same. This is because they use the same syntax within the template system: {{#variable_name#}}. So actually if you set a config variable, it will also be available as a language variable and vice versa. In other words, choose your variable names accordingly to avoid mixups.

Read the related section in the template syntax documentation for more details.


Properties

variable The one public property of this library is the variable object. This is a stdClass object that contains all of the configuration variable values by key. It is a read-only value, but you can set its value using set_variables(). This is the same key/value pair object as the one pointed to by the language library.

Example:

$this->zajlib->config->variable->my_config_variable

load()

Loads up the configuration file. The file name should be specified relative to the conf folder. Files can be located in any of the conf folders of active plugins and will be loaded according to plugin hierarchy.

$this->zajlib->config->load($config_file_name)

@param string $config_file_name The file name should be specified relative to the conf folder. This can be given as a full file name (‘sample.conf.ini’) or just as the name (‘sample’) – the later will look for any files with name.conf.ini format.
@param string $section The section to compile. If false (or left empty) the entire file will be compiled.
@param boolean $force_set This will force setting of variables even if the same file / section was previously loaded. Defaults to false.
@param boolean $fail_on_error If set to true (the default), it will fail with fatal error.
@return boolean Returns true if successful, false otherwise.

set_variables()

Sets the key/value variable object. Be careful, this overwrites the entire current setting. Because conf and lang are actually the same both conf and lang variables will be overwritten.

Typically you should not use this method in the course of normal program logic – it’s useful for testing and other purposes.

$variables = (object) array('a_key'=>'A value', 'b_key'=>'B value');
$this->zajlib->config->set_variables($variables);

@param stdClass $variables The key/value pairs to use for the new variable.
@return boolean Always returns true.

reset_variables()

Sets the key/value variable object. Be careful, this overwrites the entire current setting. Because conf and lang are actually the same both conf and lang variables will be overwritten.

Typically you should not use this method in the course of normal program logic – it’s useful for testing and other purposes.

$this->zajlib->config->reset_variables();

@return boolean Always returns true.

Other methods

Additional methods are available in this library but are reserved for system use. See full, generated documentation for more info.

Outlast Web & Mobile Development (c) 2018 | Privacy Policy |