Welcome Guest, Not a member yet? Register   Sign In
Preventing DRY in OOP
#6

[eluser]CroNiX[/eluser]
No, it gets autoloaded by the framework when it calls the native class. If you follow the first link I posted exactly, it will work.

CI will load the normal object, like CI_Controller. Then it automatically checks to see if it was extended with MY_Controller. If it exists, it loads that. Then your individual controller class, like "logged_class".

You ONLY use the MY_ prefix when you extend a CI NATIVE CLASS, not your own. And it must be named exactly the same as its counterpart.

For example, you put:
Code:
class My_Logged_Class extends CI_Controller {

when it needs to be (including exact capitalization)
Code:
class MY_Controller extends CI_Controller

And then YOUR controllers extend MY_Controller instead of CI_Controller like normal (but don't use MY_ for the name of YOUR controller!!)
Code:
class Logged_Class extends MY_Controller {

See these userguide pages for more info:
http://ellislab.com/codeigniter/user-gui...asses.html
http://ellislab.com/codeigniter/user-gui...aries.html


Messages In This Thread
Preventing DRY in OOP - by El Forum - 01-09-2014, 05:44 AM
Preventing DRY in OOP - by El Forum - 01-09-2014, 10:01 AM
Preventing DRY in OOP - by El Forum - 01-09-2014, 10:33 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 01:41 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 05:22 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 10:11 AM
Preventing DRY in OOP - by El Forum - 01-10-2014, 02:12 PM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:12 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:44 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 05:54 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:09 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:10 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:13 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:17 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:29 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:33 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:49 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:51 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 07:54 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 09:16 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 09:58 AM
Preventing DRY in OOP - by El Forum - 01-11-2014, 06:09 PM
Preventing DRY in OOP - by El Forum - 01-12-2014, 05:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB