Welcome Guest, Not a member yet? Register   Sign In
Extending controller, why?
#1

[eluser]solid9[/eluser]
So what is the advantages of extending My_controller?

For,
Extending admin class
Extending users class
etc...

And what is the dis-advantages of using only one class
for the entire system?

Hope someone will give shed.
And give a good scenario for an example.

Thanks in advanced.

#2

[eluser]CroNiX[/eluser]
It really depends on the site and application. Many can use just the stock CI_Controller and be just fine.

For systems that have a public and private section, it's sure a lot easier to have a single admin base controller that handles authentication on every single admin page rather than having to retype the authentication into the top of every admin controller. And, if something ever changes with the authentication, you only have 1 place to update it now instead of every admin controller.

Basically, it's the same as any other piece of code. If you use it over and over, code it once and reuse it where needed instead of putting the same code everywhere.
#3

[eluser]solid9[/eluser]
Ah I get it now.

It's for portability
and for organize purpose.

Thanks Cronix




Theme © iAndrew 2016 - Forum software by © MyBB