Welcome Guest, Not a member yet? Register   Sign In
Where to put plain object classes?
#42

(01-05-2015, 12:49 PM)sneakyimp Wrote:
(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()
       {
               require_once APPPATH . "models/Testmodel.php";
               $v = new Testmodel();
               $v->foo();
       }

If you don't know how to load a model, read the documentation. It looks like you want to use CodeIgniter but refuse to learn how it works or you try to reinvent how it's supposed to work. If you know it needs "$this->load->model()" why are you wasting our times telling us you know you need to call load->model, but you refuse to call it and then complain it doesn't work.
Reply


Messages In This Thread
Where to put plain object classes? - by geekita - 12-02-2014, 05:51 AM
RE: Where to put plain object classes? - by includebeer - 01-05-2015, 06:22 PM
RE: Where to put plain object classes? - by Jamie - 01-06-2015, 05:18 AM
RE: Where to put plain object classes? - by Jamie - 01-06-2015, 03:08 PM



Theme © iAndrew 2016 - Forum software by © MyBB