forked from adampatterson/Tentacle
-
Notifications
You must be signed in to change notification settings - Fork 1
Libraries
Adam Patterson edited this page Dec 18, 2012
·
1 revision
Libraries in Dingo give your applications advanced functionality. An example would be database access.
Libraries can be loaded from controllers, views, helpers, or even other libraries. It only takes one line of code to load a library.
load::library('db');
The above code would load the Databasing library that is included with Dingo.
If you are going to use a particular library a lot, then you should consider auto loading it by adding it to the autoload_libraries array
in application/config/development/config.php
. For example, you could auto load the Databasing library by editing config.php like so:
/* Auto Load Libraries */
config::set('autoload_libraries',array('db'));
It is also possible to load libraries on a controller-by-controller basis by adding the $autoload_libraries
array to the controller class.
class main_controller
{
public $autoload_libraries = array('db');
// ...
}