Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14348

Codeigniter: Load Library in a Core Class

$
0
0
Hey everbody!

I want to extend the /system/core/Log.php library with a couple of functions. One function should send a mail in case of an error via the custom function sendMail() which is part of the Custom_library.php.

Thus, I created the file /application/core/MY_Log.php

PHP Code:
class MY_Log extends CI_Log {
 
 public function __construct()
 
 {
 
   parent::__construct();
 
 }

 
 public function write_log($level$msg)
 
 {
 
   $result parent::write_log($level$msg);

 
   return $result;
 
 }


The problem: I'm not able to load the Custom_library.php. None of these approaches worked:

PHP Code:
//aproach 1    
$this->load->library('Custom_library');

//aproach 2  
$CI =& get_instance();
$CI->load->library('Custom_library'); 

The question: Is it possible to load and utilize a Library in a Core Class?

Merci!

Viewing all articles
Browse latest Browse all 14348

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>