Welcome Guest, Not a member yet? Register   Sign In
Accessing Session in a custom helper file
#1

[eluser]Unknown[/eluser]
I am trying to access the session object in a custom helper file. But an error is thrown when calling

$this->session

Is there another way to access it?

THanks,
Randy
#2

[eluser]JamieBarton[/eluser]
HI,

You'll need to get an instance of the Code Igniter object to do that.

You can make a variable called $CI in your contruct method, like this:
Code:
$CI =& get_instance();

Then to get the session you would then replace $this, with $CI, such as:
Code:
$CI->session->whatever();


Hope this helps Smile




Theme © iAndrew 2016 - Forum software by © MyBB