Codeigniter and Multiple Inheritance?

Drifter

New Member
Wondering if this is even possible or a limitation of PHP, googling around seems to be the case but maybe I'm missing a clever solution here.Hopefully this will make sense. Right now I have two portions to my site, an admin and client side. I have been able to split it into two controllers(admin and client) that inherit from a base MY_Controller class, but the problem I have is implementing my authentication controller.There is a lot of shared code between the client/admin logins, and right now I'd either have to create an auth controller for each admin and client that extends the base (which means a lot repeated code), or just extend the MY_Controller class and use if/thens in each function, which then becomes kind of messy (and also bypasses the admin/client parent classes which defeats the purpose of having them...).I'm wondering if there is a way to have the Auth controller be "neutral"(?) and able to inherit from either the admin/client controllers, so if X is the base controller, and Y is the Auth...\[code\]X -> Admin Controller -> YX -> Client Controller -> Y\[/code\]I am using an authentication library to encapsulate some of the lower level functions and would rather not be sticking layout logic and stuff like that in there. Forgive me if this is a stupid question. Thanks!
 
Back
Top