I have been trying to get the CodeIgniter view to work with passing an object and an array at the same time, however it seems to break when I add the object.
Generally in CodeIgniter, when you create a variable in the Controller:$data['title'] = 'Welcome to CodeIgniter', you would access that variable in the View as: $title,
I need to pass my userdata which I retrieve by:
$data['title'] = 'welcome to codeigniter';
$this-db->where('id', $id);
$user = $this->db->get('users')->row();
$this->load->view('welcome', [
'data' => $data,
'user' => $user
]);
However, when I get to my view, $active is undefined, and I have to access the it by $data['title']
I have also tried adding everything to one array:
$data = array(
'title' => 'welcome to codeigniter',
'active' => 'home',
'user' => $user,
);
However, it did not work.
If this doesn't make sense I apologize, I am trying to explain my issue as best as I can, if you need further information, please let me know.
Thanks, Moonblaze
$title, not$active..