• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.