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?
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:
MY_Common.php
put somewhere in your project (maybe application/core/
to mirror other similar extends)index.php
file in the root of the projectinclude APPPATH.'core/MY_Common.php';
before the closing require_once BASEPATH.'core/CodeIgniter.php';
lineNow if you have you have a load_class
function in your MY_Common.php
it will shadow the original version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With