MY_Controller::__construct PHP Method

__construct() public method

Constructor
public __construct ( )
    public function __construct()
    {
        parent::__construct();
        // Start benchmark
        $this->benchmark->mark('my_controller_start');
        // Load needed libraries
        if (!defined('ENV') && !$this->db->table_exists('settings')) {
            redirect('setup');
            die;
        }
        // Load needed libs
        $this->load->library('session');
        $this->load->library('simpletags');
        $this->load->library('settings/settings');
        $this->load->library('cache/cache');
        $this->load->library('addons/events');
        $this->load->library('users/users_auth');
        // Setup first event
        $this->events->trigger('my_controller_start');
        // Run the daily cron job
        $this->_cron();
        // Work out module, controller and method and make them accessable throught the CI instance
        $this->module = $this->router->fetch_module();
        $this->controller = $this->router->fetch_class();
        $this->method = $this->router->fetch_method();
        // Setup ending my_controller event.
        $this->events->trigger('my_controller_end');
        // End Benchmark
        $this->benchmark->mark('my_controller_end');
    }

Usage Example

Example #1
0
 public function __construct()
 {
     parent::__construct();
     $this->load->model('house_model');
     $this->load->model('financials_model');
     $this->load->model('projects_model');
 }
All Usage Examples Of MY_Controller::__construct