![]() |
Problem with load->model() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Problem with load->model() (/showthread.php?tid=47617) |
Problem with load->model() - El Forum - 12-15-2011 [eluser]Unknown[/eluser] Hy everybody. I'm novice in CI and I'm making a site to train. The site works very well with Ajax and JQuery, but I want load the pages from a database instead of a file '.php'. To this I insert the CI on production. I was following the help pages but I had a problem with the function load->model. I want that the work on this way: I click on menu link, the JQuery sends a ajax request to 'index.php/layout/ajax/' + hash (where hash is the page to load), the controller layout.php loads the model and returns to JQuery the page requested. The problem starts here, because I think that the CI will make a object with my load->model('Ajax_model) but the return is this: class Ajax_model extends CI_Model { function Ajax_model() { parent::Model(); } function get($page) { $query = $this->db->query( 'SELECT content FROM pages WHERE pagename="' . $page . '"' ); return $query->result(); } } Fatal error: Class 'Ajax_model' not found in C:\xampp\htdocs\mySite\system\core\Loader.php on line 303 Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); Code: class Ajax_model extends CI_Model { I'm crazing about this. Sugestions is extremely welcome. (Sorry by my bad english) PS: My CodeIgniter is 2.1.0 |