Welcome Guest, Not a member yet? Register   Sign In
Simple question about autoloading the database
#1

[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
#2

[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?
#3

[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.




Theme © iAndrew 2016 - Forum software by © MyBB