Welcome Guest, Not a member yet? Register   Sign In
Accessing the $config array from my custom helper
#1

[eluser]Fabdrol[/eluser]
Hi guys!

I've written some extra helper functions inside my system/helpers folder. It contains some lifeline functions for my application.

Now, Since the app will run on different hosts later on, I want to keep control of every asset folder, and I defined them in my custom $config array.

Using
Code:
$this->config->item('icon_path');

the system generates the following error:
Code:
Fatal error: Using $this when not in object context in /Users/Fabian/Sites/Dyn4/app/system/helpers/dynamics_helper.php on line 21

My conclusion is, the $this pointer doesn't point to the CI object from the helper. (which isn't that strange)

Q: Is there a way that I can access the $config array from the helper?

thanks in advance!
#2

[eluser]umefarooq[/eluser]
you can use in you helper

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

[eluser]Fabdrol[/eluser]
Thank you umefarooq!




Theme © iAndrew 2016 - Forum software by © MyBB