I am trying to use $this->load->add_package_path to add a new sub-application to my CI app. I can see how to use this for views and such: just put
$this->load->add_package_path("/mypackage");
in the controller ctor. Unfortunately, that doesn’t help, because I want to find controllers from the package path: it seems like a chicken-and-egg problem. Is there somewhere else I can put a add_package_path call (such as index.php)?
Figured it out by tracing through CI. Turns out you can’t do this. You can put your own controllers in a subdirectory of /application/controllers, but you cannot put them someplace else: in particular, as http://codeigniter.com/user_guide/libraries/loader.html implies,
“Your own files” not including controllers. I ended up being able to get it to look to the ENVIRONMENT setting in addition to APPPATH by making changes to CodeIgniter.php and Router.php. I don’t like making this kind of change, however, so I backed out the changes. I’ll put this here in case somebody else can benefit from it.
Router.php change:
CodeIgniter.php change, ’round about line 246: