Overwrite CodeIgniter Common.php
codeigniter
Solution
There's no officially supported way to do this by the built in extending mechanisms. Consider some other way to achieve your goal.
However the functions inside `Common.php` are all wrapped inside an `if` checking if the function is already exists or not so you can do the following:
- Create your `MY_Common.php` put somewhere in your project (maybe `application/core/` to mirror other similar extends)
- Open your `index.php` file in the root of the project
- insert `include APPPATH.'core/MY_Common.php';` before the closing `require_once BASEPATH.'core/CodeIgniter.php';` line
Now if you have you have a `load_class` function in your `MY_Common.php` it will shadow the original version.
Problem
There is a method in code igniter under system/core/Common.php called load_class(). I would like to overwrite this method. Usually to overwrite a code igniter class I create a file such as MY_Common.php however in this case Common.php is a collection of methods and there are no classes that encapsulates them. So how exactly do I do this?