load all class files in a folder in codeigniter? -


how load class files in folder in codeigniter?

its when develop, create , delete class files often, don't want add/remove manually in autoload.php.

thanks!

if want autoload directory of libraries, in application/config/autoload.php file, replace $autoload['libraries'] this:

require basepath."helpers/directory_helper".ext;  $libraries = directory_map(apppath."libraries/", true);  foreach($libraries $library) {     if( ! is_array($library))     {         $class = str_replace(ext, "", $library);          $autoload['libraries'][] = strtolower($class);     } } 

i haven't tested that, i'm guessing work. write own helper file own function , require instead of ci's directory_helper. way load libraries, helpers, configs, models, etc. configure load sub directories, too... if wanted.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -