onlinecode

CodeIgniter Autoload – what is CodeIgniter Autoload

CodeIgniter Autoload – what is CodeIgniter Autoload

CodeIgniter Autoload :: comes with an “Autoload” feature that include libraries, helpers, models and others to be initialized automatically every time when system is runs. If we need certain globally resources throughout your application, then we should consider “Autoload” them for convenience.

To CodeIgniter Autoload resources, open file application/config/autoload.phpand add item that we want to loadede in autoload array.

CodeIgniter Autoload file specifies which systems should be loaded by default(it self).
If we say it in other words, The files initialized automatically every time the system runs(default).

These are the things you can load CodeIgniter Autoload:

  1. Libraries
  2. Custom config files
  3. Helper files
  4. Models
  5. Language files

Libraries CodeIgniter

These are the classes situated in the ‘application/libraries' organizer or in your application/libraries folder. $autoload alternative 'libraries' is a rundown of libraries that ought to be stacked. eg.database, session, email, frame approvals and so forth.

// libraries
$autoload['libraries'] = array();

Helper CodeIgniter

These are classes located in the folder ‘application/helper’ . $autoload option ‘helper’ is a list of helper collections that we will need to get work done. eg. form, URL, text helpers etc.

// helper
$autoload['helper'] = array();

Config CodeIgniter

These are the classes located in folder ‘config’. This item is intended for use ONLY if you have created custom config files. Otherwise, leave it blank.

// config
$autoload['config'] = array();

Language CodeIgniter

These are the classes located in the ‘system/language’ folder.

// language
$autoload['language'] = array();

Model CodeIgniter

These are the classes located in the ‘models’ folder. $autoload option ‘model’ allows you to autoload models.

// model
$autoload['model'] = array();

Sample autoload.php configuration for CodeIgniter Autoload

// libraries
$autoload['libraries'] = array('database','session','email','validation');
// helper
$autoload['helper'] = array('url','form','text','date','security');
// model
$autoload['model'] = array();
// config
$autoload['config'] = array();

You also like codeigniter select query and codeigniter join tables and Codeigniter Delete Query

Exit mobile version