Posted By

sybrex on 10/23/10


Tagged

autoload codeigniter


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

sybrex


Codeigniter autoload


 / Published in: PHP
 

  1. function __autoload($class)
  2. {
  3. if (strpos($class, 'CI_') !== 0)
  4. {
  5. if (is_file($location = APPPATH.'libraries/'.$class.EXT))
  6. {
  7. include_once $location;
  8. }
  9. else if (is_file($location = APPPATH.'core/'.$class.EXT))
  10. {
  11. include_once $location;
  12. }
  13. }
  14. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: zoranmk on October 27, 2010

This is good one, also i would suggest to put this in the Common.php file which is in the system/core folder, but also be careful, cause PHP allows only one __autoload magic method.

You need to login to post a comment.