Where to put plain object classes? |
(01-01-2015, 12:30 PM)includebeer Wrote: What? I don't know what you have done but you don't need to include anything to use a model!You are incorrect, sir! If you want to extend CI_Model, you must either a) include/require system/core/Model.php explicitly OR b) call $this->load->model() to get CI to require/include the CI_Model class for you. To prove, try downloading a fresh CI3 from here: http://www.codeigniter.com/download Edit the Welcome controller so it's index function looks like this: Code: public function index() And create a Testmodel class in application/models/Testmodel.php that contains this: Code: class Testmodel extends CI_Model { The result: Code: Fatal error: Class 'CI_Model' not found in /path/to/CI/application/models/Testmodel.php on line 2 |
Welcome Guest, Not a member yet? Register Sign In |