Welcome Guest, Not a member yet? Register   Sign In
Extend Controller Multiple Times
#1

[eluser]taggedzi[/eluser]
Hello,

I'm hoping a CI guru out there can save me some effort.

I have extended CI_Controller with a class Named MY_Controller, easy enough. Now I want to create new extensions of CI_Controller. I want all the functions from CI_Controller, but I will be adding a completely different set of functions based on the interface...

Basically all I want to figure out how to do is create SEVERAL extensions of the CI_Controller. (I want to use all the stuff built into controller, but have completely different functions available.)


Something like this:

Code:
CI_Controller
    -> class MY_Controller extends CI_Controller (Includes a series of user functions)
        -> class page extends MY_Controller (using all the function from MY_Controller)
        -> class other extends MY_Controller
        -> More Sub classes
    -> class MY_Second_Controller extends CI_Controller (A completely different set of user functions)
        -> class look extends MY_Second_Controller (using all the functions from MY_Second_Controller)
        -> More classes using MY_Second_Controller....
    -> class MY_Third_Controller extends CI_Controller
        -> More classes using MY_Third_Controller....
Basically I'm trying to use CI_Controller as a base for several different Interfaces that will be used on a single site. I only need 3 total (The site has 3 distinct interfaces to the public).

I know PHP can do this, I'm just not sure how to do it in CI. The site I'm working on is a very large site, and I don't want to have to repeat all the controller Code for each aspect.

Thanks any help is welcome Smile




Theme © iAndrew 2016 - Forum software by © MyBB