CI_Loader::model()

model($model[, $name = ''[, $db_conn = FALSE]]) Parameters: $model (mixed) – Model name or an array containing multiple models $name (string) – Optional object name to assign the model to $db_conn (string) – Optional database configuration group to load Returns: CI_Loader instance (method chaining) Return type: CI_Loader $this->load->model('model_name'); If your model is located in a subdirectory, include the relative path from your models directory. For example, if you hav

CI_Loader::library()

library($library[, $params = NULL[, $object_name = NULL]]) Parameters: $library (mixed) – Library name as a string or an array with multiple libraries $params (array) – Optional array of parameters to pass to the loaded library’s constructor $object_name (string) – Optional object name to assign the library to Returns: CI_Loader instance (method chaining) Return type: CI_Loader This method is used to load core classes. Note We use the terms “class” and “library” interchangeably.

CI_Loader::language()

language($files[, $lang = '']) Parameters: $files (mixed) – Language file name or an array of multiple language files $lang (string) – Language name Returns: CI_Loader instance (method chaining) Return type: CI_Loader This method is an alias of the language loading method: $this->lang->load().

CI_Loader::is_loaded()

is_loaded($class) Parameters: $class (string) – Class name Returns: Singleton property name if found, FALSE if not Return type: mixed Allows you to check if a class has already been loaded or not. Note The word “class” here refers to libraries and drivers. If the requested class has been loaded, the method returns its assigned name in the CI Super-object and FALSE if it’s not: $this->load->library('form_validation'); $this->load->is_loaded('Form_validation'); // r

CI_Loader::helper()

helper($helpers) Parameters: $helpers (mixed) – Helper name as a string or an array containing multiple helpers Returns: CI_Loader instance (method chaining) Return type: CI_Loader This method loads helper files, where file_name is the name of the file, without the _helper.php extension.

CI_Loader::get_vars()

get_vars() Returns: An array of all assigned view variables Return type: array This method retrieves all variables available to your views.

CI_Loader::get_var()

get_var($key) Parameters: $key (string) – Variable name key Returns: Value if key is found, NULL if not Return type: mixed This method checks the associative array of variables available to your views. This is useful if for any reason a var is set in a library or another controller method using $this->load->vars().

CI_Loader::get_package_paths()

get_package_paths([$include_base = TRUE]) Parameters: $include_base (bool) – Whether to include BASEPATH Returns: An array of package paths Return type: array Returns all currently available package paths.

CI_Loader::file()

file($path[, $return = FALSE]) Parameters: $path (string) – File path $return (bool) – Whether to return the loaded file Returns: File contents if $return is set to TRUE, otherwise CI_Loader instance (method chaining) Return type: mixed This is a generic file loading method. Supply the filepath and name in the first parameter and it will open and read the file. By default the data is sent to your browser, just like a View file, but if you set the second parameter to boolean TRUE it

CI_Loader::driver()

driver($library[, $params = NULL[, $object_name]]) Parameters: $library (mixed) – Library name as a string or an array with multiple libraries $params (array) – Optional array of parameters to pass to the loaded library’s constructor $object_name (string) – Optional object name to assign the library to Returns: CI_Loader instance (method chaining) Return type: CI_Loader This method is used to load driver libraries, acts very much like the library() method. As an example, if you wo