CodeIgniter Forums
extend MY_Controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: extend MY_Controller (/showthread.php?tid=41932)

Pages: 1 2


extend MY_Controller - El Forum - 05-21-2011

[eluser]InsiteFX[/eluser]
It has something to do with the new CI 2.0, but for some reason it does not load all of the application core classes.

I would double check your __autoload and make sure it matches the one I posted for you, it is an update to Phil's __autoload.

I use HMVC and it uses SPL_Autoload so no need for me to use the __autoload in config.

InsiteFX


extend MY_Controller - El Forum - 05-21-2011

[eluser]theprodigy[/eluser]
At work, we use Modular Extensions, so that may be the difference. ME might have something in it that is allowing it to work.


extend MY_Controller - El Forum - 05-22-2011

[eluser]Zawardo[/eluser]
[quote author="InsiteFX" date="1306025400"]
I would double check your __autoload and make sure it matches the one I posted for you, it is an update to Phil's __autoload.
[/quote]

You were right Smile
i updated. Thanx again.


extend MY_Controller - El Forum - 06-10-2011

[eluser]Unknown[/eluser]
[quote author="InsiteFX" date="1306017226"]I dont know if they have fixed it but before you had to use an autoload in the config.php
Code:
/*
| -------------------------------------------------------------------
|  Native Autoload - by Phil Sturgeon. New Version!
| -------------------------------------------------------------------
|
| Nothing to do with config/autoload.php, this allows PHP autoload to work
| for base controllers and some third-party libraries.
|
| If using HMVC you do not need this! HMVC will autoload.
|
| Place this code at the bottom of your application/config/config.php file.
*/
function __autoload($class)
{
    if (strpos($class, 'CI_') !== 0)
    {
        if (file_exists($file = APPPATH . 'core/' . $class . EXT))
        {
            include $file;
        }

        elseif (file_exists($file = APPPATH . 'libraries/' . $class . EXT))
        {
            include $file;
        }
    }
}

InsiteFX[/quote]


Thank you for this! Works perfectly (CI 2.0.2)


extend MY_Controller - El Forum - 06-11-2011

[eluser]InsiteFX[/eluser]
Just a NOTE here! If you use HMVC it uses SPL_Autoload so you would not need this...

InsiteFX