Several types of custom controller #1287

dazld opened this Issue Apr 24, 2012 · 2 comments

3 participants


I've noticed what seems to be a major weakness in CI's handling of controllers.

The functionality provided by being able to extend the native controller is excellent, but I don't understand why we can't have several types of extended controllers. I absolutely do not want to be handling stuff like front end calls through a page router, or mixing admin logic in display controllers.

Is there a way to be able to have things like

class Cart extends MY_Cart {
    // etc

class Pages extends MY_Pages {
    // etc 

class Admin extends MY_Admin {
    // and so on

Any ideas?


It's been possible for a while now, I wrote an article for 1.7.1 back in 2010 that shows you how:

Trouble is working out a decent autoloading system that will handle this and everything else at the same time. How far does autoloading go, and what should the limitations be?

class MY_Controller {}
class Cart_Controller {}
class Pages_Controller {}
class Admin_Controller {}

... extend as you wish.

@narfbg narfbg closed this Jul 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment