• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reading Session Var in Heper


I am defining a session var in my controller and using a helper file in the view. I am not able to read the session var defined in controller using $this->session->userdata('item'); It errors that helper is not a class. Is there a way to do this instead of passing var to each helper function call from views.


What helper are you using?

Can you give us an example of your controller (including top line and constructor), and your view file?

In controller:
$this->session->set_flashdata('flow', 'web');

In view:

I created a helper "my_app_ui".

Calling the following function from view:
echo printSumRow($firm_data,'email','Email');

function printSumRow($pData,$pField,$pLabel,$pLongText=FALSE)
$flow = $this->session->flashdata('flow');

Inside the printSumRow function in helper I don't have access to $this->session. I can read this in view. I don't want to pass this in each and every function call to "printSumRow", I thought session might do.


Use something like that:
function printSumRow($pData,$pField,$pLabel,$pLongText=FALSE)
   $CI =& get_instance();
   $flow = $CI->session->flashdata('flow');


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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