Created
April 16, 2014 00:42
-
-
Save noevidenz/10793519 to your computer and use it in GitHub Desktop.
Native Autoload - by Phil Sturgeon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
| ------------------------------------------------------------------- | |
| 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; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment