I want to use a central CI setup for multiple sites. The way I handle this is I created a package called MPACK and added it to autoload in the config file of each site.
Folder Structure:
/main
/system (CI 2 System folder)
/MPACK
/site1
/application
site2
/application
Inside this MPACK I have share libraries, models, helpers, etc.
However, I would like to have an extended MY_Form_Validation that would be common to ALL sites. Adding the class file to /MPACK/libraries fails. Adding it to /site1/application works fine, as expected.
Is there any way to do this extending inside MPACK?
Thank you for your time.
Please try this:
You can get more information from CodeIgniter User Guide – Loader Class. 🙂
You can also autoload your package in
/application/config/autoload.php:$autoload['packages'] = array('/path/to/MPACK');EDIT: turn out that the above solution doesn’t work, because Loader always look for APPPATH & BASEPATH first, and I not sure modifying this core class won’t break something. Here is another solution in theory:
You should have your MPACK form validation lib, and sites’ form validation lib should be symlinks to the MPACK one:
If you just use everything from MPACK, nothing specifically for /site1 or /site2, just make a folder link:
Hope this help =)
You can read more here: http://codeigniter.com/wiki/Multiple_Applications_via_Symlinks/