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

[eluser]me_not_you[/eluser]
Hi,

I'm looking to extend a controller with a diffrent controller.

Exemple:

I've got a controller User and i would like to have Admin extends user...

I dont see how to do it, because of admin needing to extend from Controller...

Thanks for your help
#2

[eluser]Dam1an[/eluser]
You can chain controllers to any depth you want
So you can have Admin_controller > User_controller > MY_Controller > Controller

If you're not extending the CI controller (the last step) you will need to manually include the file to extend suign PHPs include function
#3

[eluser]me_not_you[/eluser]
Thanks for the queek answers, but i dont see how i would chaine them together...

I mean this does not work..

Code:
class Admin>User extends Controller {
#4

[eluser]Dam1an[/eluser]
SOrry, I was only using > to show the chain
You would do
Code:
include('path/to/User.php');
class Admin extends User {
...
}
And then User would extend the base controller as normal
#5

[eluser]me_not_you[/eluser]
That works... ;-)

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB