I am new to Codeigniter and the version I am using is the latest Codeigniter v2.1.4.
I am doing some simple CRUD as a start for making my own web blog but it's getting an error message on my controller as following.
Message: Undefined property: Site::$site_model
Controller
function blog() {
$data = array();
$query = $this->site_model->get_records();
if (isset($query)) {
$data['records'] = $query;
}
$data['main_content'] = 'blog';
$this->load->view('includes/template', $data);
}
It's complaining on this line $query = $this->site_model->get_records();
Model
function get_records() {
$query = $this->db->get('data');
return $query->result();
}
db library is loaded as well..
$autoload['libraries'] = array('database');
What am I doing wrong?