application/core/My_Controller.php
/**
     * Load the view
     * 
     * This should be used by controllers
     * 
     * it autoload the layout and set 'user' index to current user for the view 
     * 
     * @param type $file
     * @param type $data
     * @param type $return
     * @param type $load_layout
     * @return type
     */
Load the view

This should be used by controllers

it autoload the layout and set 'user' index to current user for the view


Load the view This should be used by controllers it autoload the layout and set ' user ' index to current user for the view
protected function _view($file = '' , $data = '' , $return = false , $load_layout = true)
    {
        $this->_current_user();
        if(!$data)
        {
            $data = array();
        }
        $data['user'] = $this->current_user;
        $main_view = $this->load->view($file , $data , true );
        if($load_layout)
        {
            $layout = $this->load->view($this->layout , ['main_view' => $main_view] , true );
        }
        if($return) return $layout;
        echo $layout;
    }
protected function _view ( $ file = '' , $ data = '' , $ return = false , $ load_layout = true ) { $ this -> _current_user ( ) ; if ( ! $ data ) { $ data = array ( ) ; } $ data [ 'user' ] = $ this -> current_user ; $ main_view = $ this -> load -> view ( $ file , $ data , true ) ; if ( $ load_layout ) { $ layout = $ this -> load -> view ( $ this -> layout , [ 'main_view' => $ main_view ] , true ) ; } if ( $ return ) return $ layout ; echo $ layout ; }
Load the view
Load the view