Welcome Guest, Not a member yet? Register   Sign In
load Controller in Controller, CI3
#1

hi
I can't load controller in another controller in CI3, but in CI2 i do this without problem!!!
for test plz create MY_Controller in core and load a test library or model or etc
then in welcome controller or each controller you want, load another controller like my codes then see errors, i cant know why this doesn't work in CI3 plz help me Sad

and other question why CI2 benchmark is very better than CI3? it isn't bad? do you recommended me for use CI2?

"please sorry if you found any mistake in my english"

---

MY_Controller:
PHP Code:
class MY_Controller extends CI_Controller
{
    public function 
__construct()
    {
        
parent::__construct();

        
$this->load->library('cart'); // any library or model you like, you can load
    
}


and this is my welcome controller
PHP Code:
defined('BASEPATH') OR exit('No direct script access allowed');

class 
Welcome extends MY_Controller {

    public function 
index()
    {
        
$this->load->library('../controllers/_404');
        
$this->_404->index();
    }


and my _404 controller
PHP Code:
defined('BASEPATH') OR exit('No direct script access allowed');

class 
_404 extends MY_Controller
{
    public function 
index()
    {
        echo 
'404';
    }

Reply


Messages In This Thread
load Controller in Controller, CI3 - by zeos - 05-07-2015, 06:04 AM
RE: load Controller in Controller, CI3 - by zeos - 08-03-2015, 12:21 PM



Theme © iAndrew 2016 - Forum software by © MyBB