I'm building a multi-app site on CodeIgniter. I foresee some of the libraries, helpers, etc. being needed across applications. How do I share such resources between applications? It seems like I can put libraries and helpers under the system
folder, but what if I need to share models, controllers, views, too?
If you would like to share a common CodeIgniter installation to manage several different applications simply put all of the directories located inside your application directory into their own sub-directory. Each of your applications will need its own index. php file which calls the desired application. The index.
CodeIgniter is suitable for small and medium projects. but for larger projects, CodeIgniter is not a perfect solution. because of lack of functions available, it is hard to develop or customize requirements.
APPPATH is a codeigniter constant. It contains value of the full path to your application folder.
Root in codeigniter specifically means that the position where you can append your controller to your url. For example, if the root is localhost/ci_installation/index. php/ , then to access the mycont controller you should go to localhost/ci_installation/index.
This article helped me when developing multiple applications in the same install, I then used .htaccess for different applications and different domain names.
Codeigniter Wiki - Multiple Applications
You would probably have to experiment with the way the folders are set up and the way calls are made in order to access shared models controllers and views.
This post multiple sites, 1 codebase, using symlinks (with smarty) might help but might not be the way you want to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With