• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need for CI_ prefix when extending core libraries??

#1
[eluser]mark-e-mark[/eluser]
I seem to be running into a little issue when I try to extend a core class.

The user guide suggests the following prototype to extend a core class:

Code:
class MY_CoreClass extends CI_CoreClass {

    function My_CoreClass()
    {
        parent::CI_CoreClass();
    }
}

.. where CoreClass is obviously replaced with the class I am trying to extend.

However, CI chucks a fatal error "Fatal error: Class 'CI_CoreClass' not found ....".

I CAN, however, get my extensions to work if I drop the CI_ prefix:

Code:
class MY_CoreClass extends CoreClass {

    function My_CoreClass()
    {
        parent::CoreClass();
    }
}

Is there something simple I'm doing wrong, or is there an error in the CI documentation?

#2
[eluser]WebsiteDuck[/eluser]
Which core class are you trying to extend?

I believe Model and Controller are not prefixed with CI_

#3
[eluser]mark-e-mark[/eluser]
Aaah. That may be it.

I'm trying to extend Model.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.