![]() |
Simple question about autoloading the database - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Simple question about autoloading the database (/showthread.php?tid=9414) |
Simple question about autoloading the database - El Forum - 06-24-2008 [eluser]markanderson993[/eluser] Hey, I am very new to CodeIgniter so please excuse this very simple and nooby question. In the autoload.php file I have added the database class to be autoloaded from libraries. However, after looking at this bit of code a second time it struck me that even though it worked flawlessly, it made no sense. autoload['libraries'] = array('database') only autoloads files in the libraries folder. The database.php file is in the config folder.... how then is it being autoloaded??? Mark Simple question about autoloading the database - El Forum - 06-24-2008 [eluser]Sarre[/eluser] Check out the Loader class in the system/libraries folder. Around line 889 you'll find the _ci_autoloader() function. I think that should explain it? Simple question about autoloading the database - El Forum - 06-24-2008 [eluser]Tom Glover[/eluser] The default config files are automatically loaded by CI core. Auto loading the database library does not automatically connect CI to the database, but saves you writing $this->load->library('database') in every model. CI connects to the database when you the the model function to or when you load the model. all the information about this can be found in the database section of the user guide. |