Wondering if there is a way to check if a config variable is set in Codeigniter?
if ( isset($this->config->item('configItem'))) {
//do stuff
}
Seems like something like this should work? The error I get is "Expected: variable".
Thoughts?
Wondering if there is a way to check if a config variable is set in Codeigniter?
if ( isset($this->config->item('configItem'))) {
//do stuff
}
Seems like something like this should work? The error I get is "Expected: variable".
Thoughts?
Are you loading your config file?
$this->config->load('configfilename');
If you are loading it then you should use:
if ( $this->config->item('configItem')) {
//do stuff
}
The config class in CodeIgniter already handles the isset() and returns false if it can't find anything.