Welcome Guest, Not a member yet? Register   Sign In
multiple MY_Controller?
#1

[eluser]upstream[/eluser]
Hi Guys,

is it possible to have multiple MY_Controller? or rather multiple extention of MY_Controller? if so, how? Like for example. i need to extend the Controller for Admin Pages, and again, extend it for Members Pages.

If this is not possible, is there any better solution for this problem? thanks!!!
#2

[eluser]tomcode[/eluser]
Yes and No, No, You can have only one file MY_Controller.php.

But, You can define several classes inside this file :

Code:
// For all common methods
class MY_Controller extends Controller{
    
}
// Some special Member stuff
class Member_controller extends MY_Controller{
    
}
// ..
class Admin_controller extends Member_controller{
    
}
// A completely different set of stuff
class Special_controller extends Controller{
    
}
// And instead of using helper files ...
function common_helper_function()
{
}
#3

[eluser]upstream[/eluser]
i see, that's what i currently did. that is also applicable to other like form validations, correct? thank you tomcode!
#4

[eluser]tomcode[/eluser]
Sure, but I usually work rather with models and librairies than with multiple base controllers, up to You, what You like best.




Theme © iAndrew 2016 - Forum software by © MyBB