CodeIgniter Forums

Full Version: Need for CI_ prefix when extending core libraries??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

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

I believe Model and Controller are not prefixed with CI_

El Forum

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

I'm trying to extend Model.