Welcome Guest, Not a member yet? Register   Sign In
Accessing session array from embedded view
#8

[eluser]CroNiX[/eluser]
Also, the way it's written, $data isn't a class property, (it's just a method variable only existing in the method) so in index(), it doesn't know anything about $data you set in the constructor.

I'd remove the session stuff from the constructor.
I'd set the session data in index(). (just like you are)
I'd read the session data in the view.

In View:
Code:
$session_data = $this->session->all_userdata();
echo $session_data['name'];

It's kind of a waste of memory/processing passing the session data to the view as it already exists globally.


Messages In This Thread
Accessing session array from embedded view - by El Forum - 04-16-2012, 10:59 AM
Accessing session array from embedded view - by El Forum - 04-16-2012, 11:03 AM
Accessing session array from embedded view - by El Forum - 04-16-2012, 11:39 AM
Accessing session array from embedded view - by El Forum - 04-16-2012, 12:23 PM
Accessing session array from embedded view - by El Forum - 04-16-2012, 12:49 PM
Accessing session array from embedded view - by El Forum - 04-16-2012, 12:54 PM
Accessing session array from embedded view - by El Forum - 04-16-2012, 12:55 PM
Accessing session array from embedded view - by El Forum - 04-16-2012, 01:05 PM
Accessing session array from embedded view - by El Forum - 04-16-2012, 01:08 PM
Accessing session array from embedded view - by El Forum - 04-16-2012, 01:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB