[eluser]victor76[/eluser]
Hi,
I've got this Model function:
Code:
function get_last_ten_entries()
{
$query = $this->db->get('entries', 10);
return $query->result();
}
...and this Controller function:
Code:
<?php
class Blog_controller extends Controller {
function blog()
{
$this->load->model('Blogmodel','',TRUE);
$data['query'] = $this->Blogmodel->get_last_ten_entries();
$this->load->view('blogview', $data);
}
}
?>
In my View, I've used a simple print_r($data) to see if I would get anything from my DB.
This is wat it spits out:
Code:
Array
(
[view] => blogview
[vars] => Array
(
[query] => Array
(
[0] => stdClass Object
(
[id] => 1
[title] => 1st entry
[content] => blabla
[date] => 2007-10-18
)
[1] => stdClass Object
(
[id] => 2
[title] => 2nd entry
[content] => blabla
[date] => 2007-10-26
)
)
)
[return] =>
)
...and now for my newbie question
How can I acces these array values in my View?
I would like to display a simple <li><?php echo $data[0]['content']; ?></li>
But somehow this is not working...
Can anyone point me in some direction? Thnx!