Welcome Guest, Not a member yet? Register   Sign In
CI2 extending own controller
#1

[eluser]enigmas[/eluser]
Hi All,

I'm just moving my CI project to CI2 and have noticed the problem extending controller from my own controller.

Imagine, I have MY_Controller that extends CI_Controller. I placed MY_Controller.php to the folder application\core. Now, when I try to extent my usual controller with MY_Controller - I get error screen, like page can't be displaied.

Are there problems with CI2 extending MY_ controllers?
#2

[eluser]SPeed_FANat1c[/eluser]
post your code, it should work as you described. (BTW I used CI reactor but I think the same things are for CI2 core)
#3

[eluser]enigmas[/eluser]
Opps... sorry SPeed_FANat1c, my mistake.. sorry...
#4

[eluser]InsiteFX[/eluser]
You need to add this at the bottom of application/config/config.php
Code:
/*
| -------------------------------------------------------------------
|  Native Autoload - by Phil Sturgeon.
| -------------------------------------------------------------------
|
| Nothing to do with config/autoload.php, this allows PHP autoload to work
| for base controllers and some third-party libraries.
|
| Place this code at the bottom of your application/config/config.php file.
*/
function __autoload($class)
{
    if (strpos($class, 'CI_') !== 0)
    {
        @include_once(APPPATH . 'core/' . $class . EXT);
    }
}

For some reason the core is not being loaded.

InsiteFX
#5

[eluser]SPeed_FANat1c[/eluser]
@enigmas - there is no reason to be sorry Smile




Theme © iAndrew 2016 - Forum software by © MyBB