Welcome Guest, Not a member yet? Register   Sign In
$this->config->item not working in helper file
#1

[eluser]AtlantixMedia[/eluser]
hello,

can someone shed some light why accessing $this->config->item('someitem') in a helper file throws a Fatal error: Call to a member function on a non-object in....?? the config file the item is in is autoloaded with $autoload['config'] = array('myconfig/config'); Am I missing something?

thanks
#2

[eluser]tonanbarbarian[/eluser]
Helpers are external functions so they are not part of an object and therefore $this is not applicable.

If you need to access part of the controller then do it like the following

Code:
$CI =& get_instance();
$CI->config->item('someitem');
#3

[eluser]AtlantixMedia[/eluser]
aaaaaaaaah that's why. it works now. thank you very much!




Theme © iAndrew 2016 - Forum software by © MyBB