Welcome Guest, Not a member yet? Register   Sign In
How to create MY_Controller for backend and frontend
#3

[eluser]CroNiX[/eluser]
xtremer, it seems what you suggested is exactly what he is already doing.

Yes, you can have a separate base controller for front end/back end, or as many as you want.

Code:
MY_Controller extends CI_Controller {} //common to all, main "base controller", just like you are doing
Then
Code:
Front_controller extends MY_Controller {} //for front end, extends the common base
Back_controller extends MY_Controller{} //for back end, extends the common base

Then any controller dealing with the front end would extend Front_controller, and everything dealing with the backend extends Back_controller.

See this article: http://philsturgeon.co.uk/blog/2010/02/C...ing-it-DRY
You'll need to create an autoload for this to work as described in the article. By default, CI only knows to load MY_Controller and not check for anything extending it.


Messages In This Thread
How to create MY_Controller for backend and frontend - by El Forum - 09-16-2013, 08:37 PM
How to create MY_Controller for backend and frontend - by El Forum - 09-17-2013, 08:17 AM
How to create MY_Controller for backend and frontend - by El Forum - 09-17-2013, 08:31 AM
How to create MY_Controller for backend and frontend - by El Forum - 09-17-2013, 08:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB