Google News
logo
CodeIgniter - Interview Questions
Can you extend native libraries in CodeIgniter?
Yes, we can add some extended functionality to a native library by adding one or two methods. It replaces the entire library with your version. So it is better to extend the class. Extending and replacing is almost identical with only following exceptions.
 
* The class declaration must extend the parent class.
* New class name and filename must be prefixed with MY_.

For example, to extend it to native Calendar, create a file MY_Calendar.php in application/libraries folder. Your class declared as class MY_Calendar extends CI_Calendar}
Advertisement