Welcome Guest, Not a member yet? Register   Sign In
code refactor help
#4

[eluser]Colin Williams[/eluser]
When you create a controller in CI, you extend the base class Controller, inheriting all of it's methods and properties. So, if you want something to happen in every controller you create, add it to the class every Controller extends. Two ways to do this. One, copy system/libraries/Controller.php to application/libraries/Controller.php and put your "global" code in the constructor. Two, and this one might be more future-proof, create a file MY_Controller.php in application/libraries/. In that file, create a class MY_Controller that extends Controller. Then, all of your controllers will extend MY_Controller.


Messages In This Thread
code refactor help - by El Forum - 01-19-2010, 08:14 PM
code refactor help - by El Forum - 01-19-2010, 08:21 PM
code refactor help - by El Forum - 01-19-2010, 08:24 PM
code refactor help - by El Forum - 01-19-2010, 09:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB