Well, I managed to get it working, but I'm not sure if this is the best or most elegant way. First, I added "my_loader" to application / config / autoload.php in the libraries section. Then I checked that $this->load was inside the controller, and it was an instance of CI_Loader, so in the constructor of the MY_Loader class I made a CI reference and replaced its load property with a reference to MY_Loader: $CI->load = $this; .
The final MY_Loader class is the following:
class MY_Loader extends CI_Loader { function __construct() { parent::__construct(); $CI =& get_instance(); $CI->load = $this; } function database($params = '', $return = FALSE, $active_record = NULL) { parent::database($params, $return, $active_record);
Please, if you come with a better / reasonable solution, send a response. Thanks.
source share