[eluser]Kurai[/eluser]
Now I feel really stupid.
I've created a simple database for a very basic blog application. Then I've put some data in the only table (blog_posts) I've got through the scaffolding feature. Then I built up a very basic controller with a "die" statement for testing purposes, and consequently a model which fetches data from the db and then passes them to the controller.
The thing is, controller is working as long as I don't load the model. When I do this, trying to fetch data, all I've got is a blank page. The code is very simple, and I can't understend where the error is. Here's my model:
Code:
<?php
class Blogmodel extends Model{
function Blogmodel{
parent::Model();
}
function get_posts(){
$query = $this->db->get('blog_posts');
return = $query->result();
}
}
?>
and then the controller:
Code:
<?php
class blog extends Controller{
function Blog(){
parent::Controller();
$this->load->model('Blogmodel', 'blog', true);
}
function index(){
$data['title'] = "Titolo del blog";
$data['heading'] = "Primo Blog";
$data['query'] = $this->blog->get_posts();
die (print_r($data));
}
}
?>
Probably there's something very stupid I can't get...