Auto-Loading Models in CodeIgniter
October 09th, 2007
Quietly added, CodeIgniter now has the ability to auto-load Models. This is super handy if you have a site-wide need for a model, say a “settings” model, or an “auth” model. The feature will be in the next CI release*, but you can grab it now if you want to. Just get a new copy of the Loader from the SVN (here it is), and add this into your config/autoloader.php file.
$autoload['model'] = array('model1_model', 'model2_model');
And magically, your models will be autoloaded ;) There are updated docs in the SVN also. If you are a true nerd, you’ll might enjoy the “foreach” variables on line 112. Well, I thought it was clever. Anyhow, enjoy it while its hot, I have no idea if those variable names will stay the same when we release. (Oh man, my nerd humour can be pretty lame…)
Features are slowly tricking into the SVN, and we’ve got many more goodies waiting to be released.
* I just wanted to drop an update, there is no release date established yet.
This entry was made on October 09th, 2007 @ 13:56 and filed into CodeIgniter.

Henrik wrote on October 09th, 2007 @ 14:07
I’ve been thinking about this very topic the last few days and thought that there must be a way to auto-load them… well… now I don’t have to.
Great work folks, keep it up!