Welcome Guest, Not a member yet? Register   Sign In
Model not recognized using My_Controller
#1

[eluser]Ed Robindon[/eluser]
I have created MY_Controller so that site wide things are added to CI_Controller.

Now my controllers extend MY_Controller and load their models in the constructor.

The problem is that when I reference the model i get an error about a non-existant object.

If I put the load statement in the functions that use the model, all is well.

Help?
#2

[eluser]ppwalks[/eluser]
Try adding the models to autoload in config.php
#3

[eluser]Ed Robindon[/eluser]
Thanks for the quick reply!

I thought about that but then wouldn't I have to autoload all of the models?

#4

[eluser]ppwalks[/eluser]
It usually solves the problem
#5

[eluser]Ed Robindon[/eluser]
While it may solve the problem, it doesn't solve the issue.

Have to think about a bit.

Thanks again.

Ed
#6

[eluser]Aken[/eluser]
Is MY_Controller.php located in application/core ?

Is your MY_Controller __construct() function spelled properly? Does it call parent::__construct() inside of it?

Did you change the MY_ prefix in your config file?

Maybe post your MY_Controller code if the above don't spark a solution.
#7

[eluser]Ed Robindon[/eluser]
Well, I figured it out...

I use xajax and it has a method (processRequest()) that is called to process the incoming XHR.

After the initial load, nothing after the processRequest is run except the
called, registered function.

I put the call to processRequest in the constructor in MY_Controller so calls to load my models were never made.

I moved the call back to the derived controller constructors and everything works...

Thanks to all for your replys.

Ed
#8

[eluser]InsiteFX[/eluser]
@Ed Robindon,

Ed I have converted the xajax pagination over to CodeIgniter 2.1.0 pagination let me know if you need it...
#9

[eluser]Ed Robindon[/eluser]
Hello,

I would be very much interested in your pagination code.

Thanks,
Ed




Theme © iAndrew 2016 - Forum software by © MyBB