[eluser]cahva[/eluser]
[quote author="millenniumdarren" date="1285558231"]
I could always set the results to a variable and access them that way, however I am trying to keep the code in the view simple and this complicates things.
[/quote]
Thats the key to keep things simple in a view. Put results in a variable from controller and pass it to the view. For example:
Controller
Code:
function show_user($id=FALSE)
{
if (!$id)
{
return FALSE;
}
$this->load->model('users_model');
$data['user'] = $this->users_model->get_user($id);
$this->load->view('show_user',$data);
}
Now when you pass that $data to your view, you will have $user variable to work with in there
View
Code:
<h1>Information for user <?php echo $user->name ?></h1>
...