![]() |
Model not recognized using My_Controller - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Model not recognized using My_Controller (/showthread.php?tid=49350) |
Model not recognized using My_Controller - El Forum - 02-16-2012 [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? Model not recognized using My_Controller - El Forum - 02-16-2012 [eluser]ppwalks[/eluser] Try adding the models to autoload in config.php Model not recognized using My_Controller - El Forum - 02-16-2012 [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? Model not recognized using My_Controller - El Forum - 02-16-2012 [eluser]ppwalks[/eluser] It usually solves the problem Model not recognized using My_Controller - El Forum - 02-16-2012 [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 Model not recognized using My_Controller - El Forum - 02-16-2012 [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. Model not recognized using My_Controller - El Forum - 02-16-2012 [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 Model not recognized using My_Controller - El Forum - 02-16-2012 [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... Model not recognized using My_Controller - El Forum - 02-17-2012 [eluser]Ed Robindon[/eluser] Hello, I would be very much interested in your pagination code. Thanks, Ed |