[eluser]a&w[/eluser]
[quote author="mark17" date="1216301321"]Thanks for your reply.
I guess we cannot use the MY_Model library class either?
I will perform some tests and see if we can use it.[/quote]
mark17: in case you find it useful I'll elaborate on what
wiredesignz said.
ME_5 uses these files:
1. application/libraries/Controller.php - replaces CodeIgniter's base application controller.
2. application/libraries/MY_Router.php - supplements CodeIgniter's router class.
3. application/libraries/Modules.php
That's it, no model class.
The front
index.php loads the front controller for the system....
CodeIgniter.php.
CodeIgniter.php loads all of the base classes and then the local controller and method called by the url.
CodeIgniter.php uses the following method to load the base classes:
Code:
//from system/codeigniter/common.php
function &load;_class($class, $instantiate = TRUE)
{
static $objects = array();
// Does the class exist? If so, we're done...
if (isset($objects[$class]))
{
return $objects[$class];
}
// If the requested class does not exist in the application/libraries
// folder we'll load the native class from the system/libraries folder.
if (file_exists(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT))
{
require(BASEPATH.'libraries/'.$class.EXT);
require(APPPATH.'libraries/'.config_item('subclass_prefix').$class.EXT);
$is_subclass = TRUE;
}
else
{
if (file_exists(APPPATH.'libraries/'.$class.EXT))
{
require(APPPATH.'libraries/'.$class.EXT);
$is_subclass = FALSE;
}
else
{
require(BASEPATH.'libraries/'.$class.EXT);
$is_subclass = FALSE;
}
}
So this means:
1. if there is a MY_whateverClass (MY_Controller in this case) in your application/libraries directory it will load that in addition to the CI version of that class. It will then
not load the Controller.php file that is part of ME_5 as a result.
2. if there is no MY_whatever class THEN it checks if there is an override in the application directory, otherwise just loads the original CI version of that class.
I didn't understand the 'why' of what was going on before and now understand it better (I think?) so thought I'd share that in case it also helped you or someone else.
I'm still looking into how to get by without MY_Controller, or what changes are required to automatically load a version of it. I think there's a way to autoload it?