1.

Explain libraries in codeIgnitor and how to extend the native library.

Answer»

Libraries are a feature-rich set of code for a particular functionality. CODEIGNITOR provides a rich set of libraries which increases the development speed of application. Default libraries can be located at system/library directory. 

To Load single library please use  $this->load->library(‘class_name’);

To Load multiple libraries please use $this->load->library(array(‘class_name1’, ‘class_name2’, ‘class_name3’));

Custom libraries to be created in the application/libraries directory. 

If we want to add one or more METHODS to the existing library then it will replace the entire library with a modified version. EXTENDING the library is a BETTER option. There are rules to do the same. 

  • Class declaration must extend the PARENT class.
  • New class name and filename must be prefixed with MY_.classname.php


Discussion

No Comment Found