Welcome Guest, Not a member yet? Register   Sign In
Loading Custom Config when CI_Controller not loaded
#1

[eluser]Unknown[/eluser]
I am trying to extend CI_Log and want to be able to load a config file but I am having trouble using get_instance() so I can load the config file. Getting this error:

Fatal error: Class 'CI_Controller' not found in .../system/core/CodeIgniter.php on line 231

Here is my code

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MY_Log extends CI_Log {
        private $enable_syslog = false;

        public function __construct()
        {  
                parent::__construct();
                $this->ci =& get_instance();
                $this->config->load('syslog');
                if($this->config->item('syslog_enable_logging') === true)
                {
                     $this->enable_syslog = true;
                }
        }  
}
?>

Is this possible to load config in this file or will I just need to find another way?

Thanks


Update: Been using codeigniter so long, I forgot about old fashion require
Code:
require_once(APPPATH . 'config/syslog.php');




Theme © iAndrew 2016 - Forum software by © MyBB