CodeIgniter Forums
Multiple application folder in CI - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Best Practices (https://forum.codeigniter.com/forum-12.html)
+--- Thread: Multiple application folder in CI (/thread-63959.html)



Multiple application folder in CI - jayhardia - 12-28-2015

Hi team,

I have a query regarding architecture level for CI.


Till date , we are using single application folder to manage front side and admin panel. But I want to update this architecture and want to use multiple application folder. 

I just want to know pros and cons for multiple application folder.

Looking forward to hear some expert views ......


Thanks


RE: Multiple application folder in CI - Bhavesh - 12-28-2015

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 folder into their own sub-folder.

For example, let's say you want to create two applications, "foo" and "bar". You could structure your application folders like this:
applications/foo/
applications/foo/config/
applications/foo/controllers/
applications/foo/errors/
applications/foo/libraries/
applications/foo/models/
applications/foo/views/
applications/bar/
applications/bar/config/
applications/bar/controllers/
applications/bar/errors/
applications/bar/libraries/
applications/bar/models/
applications/bar/views/



Ref: https://ellislab.com/codeigniter/user-guide/general/managing_apps.html


RE: Multiple application folder in CI - lama - 12-29-2015

The user guide is missing information about .htaccess and accessing default / second application...


RE: Multiple application folder in CI - komirad - 01-04-2016

I am doing it like this:
application/* for controllers front
application/admin/* for controllers for admin panel

I would also extend the controllers from a "core" controller. eg. Dashboard extends Admin_controller.
Admin_controller here would extend from MY_Controller. This way I can easily build things like access control for different areas of the applications.

So in the application/core folder, I have something like this:
MY_Controller.php
Front_Controller.php (extends MY_Controller)
Admin_Controller.php (extends MY_Controller)