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

[eluser]FrankStar[/eluser]
Thanks for the clarification. It probably helped but I still can't access the dynamic data set in the constructor from the view.

Controller's Constructor:
Code:
function __construct() {
  parent::__construct();

  // Keep the session data available for all controllers
  $data['session'] = $this->session->all_userdata();
}

Controller:
Code:
function index()
{
  $user_info = array(
   'name' => 'User Name'
  );

  $this->session->set_userdata($user_info);

  $data['main_content'] = 'home';
  $this->load->view('templates/split', $data);
}


View (template):
Code:
<?php print_r($session); ?>

Really not sure why this isn't working after reading the "Adding Dynamic Data to the View" section of the user guide :-S


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