05-04-2012, 01:39 PM
[eluser]bill19[/eluser]
Hi,
Hi I've been reading in http://ellislab.com/codeigniter/user-gui...oader.html on how to use $this->load->vars($array) to make array elements available in views, but I can't get this working.
Here is my controller:
which extends controller:
my view (user_view) is:
What do I have to do to print out the value of element 'id' of the $data array?
Thanks in advance for your help,
Bill
Hi,
Hi I've been reading in http://ellislab.com/codeigniter/user-gui...oader.html on how to use $this->load->vars($array) to make array elements available in views, but I can't get this working.
Here is my controller:
Code:
class Home extends Admin_Controller {
function __construct() {
parent::__construct();
}
function index() {
$this->load->view('user_view');
}
}
which extends controller:
Code:
class Admin_Controller extends MY_Controller {
protected $the_user;
public function __construct() {
parent::__construct();
if($this->ion_auth->is_admin()) {
$data->the_user = $this->ion_auth->user()->row();
$this->the_user = $data->the_user;
$this->load->vars($data);
}
else {
redirect('/');
}
}
}
my view (user_view) is:
Code:
h1>Protected View!!</h1>
<h4>Email: <?= $the_user->email ?></h4>
<a href="<?= site_url('user/logout') ?>">logout</a>
<?php echo $this->the_user->id;?>
<?php echo $id;?>
echo $this->the_user->id;
What do I have to do to print out the value of element 'id' of the $data array?
Thanks in advance for your help,
Bill