[eluser]Unknown[/eluser]
I load view in a controller and pass an array of data to it. When use this data as variables in a view php tells that all of them are undefined.
I tried to google but code seems to be corrent. What is wrong?
controller code:
Code:
public function index()
{
$this->sitesessions->set_session_id($this->session->userdata('session_id'));
$user_id = $this->sitesessions->check();
$logon = false;
if ($user_id == false)
$logon = true;
$data['logon'] = true;
$this->load->view('header', $data);
$this->load->view('news');
$this->load->view('footer');
}
view code:
Code:
<div>
<?php
if ($logon == false) echo "You are not authorized. " . anchor('login', 'Login');
else echo "Welcome."; ?>.
<div>
Thanks.