Webocreation

Tuesday, April 19, 2011

About the configuration class in the opencart




config:
config consists of 5 functions and they are as follows:
get($key):
$this->config->get('welcome_text_position'): is the example that check whether the data is set or not if it is not set then it will return null.
public function get($key) {
return (isset($this->data[$key]) ? $this->data[$key] : NULL);
}
set($key, $value):
This is used to set the value and is done by $this->config->set($key, $value)
public function set($key, $value) {
$this->data[$key] = $value;
}
has($key):
Check whether there is key available or not.
public function has($key) {
return isset($this->data[$key]);
}
load($filename):
This is the function which loads the file that the parameter is passed. If it does not find the file then it will return the error message saying ‘Error: Could not load config filename’
public function load($filename) {
$file = DIR_CONFIG . $filename . '.php';
if (file_exists($file)) {
$cfg = array();
require($file);
$this->data = array_merge($this->data, $cfg);
} else {
exit('Error: Could not load config ' . $filename . '!');
}
}

how to get the configuration class, uses of configuration function and its uses, function on the configuration

No comments:

Post a Comment