Welcome Guest, Not a member yet? Register   Sign In
Extending CI_Controller
#1

[eluser]boytun[/eluser]
Hello
In my application I use HMVC structure, so i try ti extand the MX_Controller with CI_Controller, so that I can load my modules in the mvc views.
I try this:
In the core folder

Code:
class MX_Controller extends MY_Controller {

public function index()
{
  
}

}

Code:
class MY_Controller extends CI_Controller {

public function __construct()
{
  parent::__construct();
}

public function index()
{
  
}

}

In the librairies folder

Code:
class Frontend_Controller extends MY_Controller {

public function __construct()
{

}

}

In the controllers folder

Code:
class Article extends Frontend_Controller {

public function __construct()
{
  parent::__construct();
}

public function index()
{
$this->load->view('myview');
}

}

In the view folder (myview.php')
Code:
<?php echo Modules::run('tasks') ; ?>

the tasks module is juste contains a echout sentence in the HMVC view

But I get this error
Fatal error: Cannot redeclare class CI in C:\xampp\htdocs\application\third_party\MX\Base.php on line 57

Please I need your Help
Thanks in advance
#2

[eluser]TheFuzzy0ne[/eluser]
So which one of those is Base.php?

I think you've got that the wrong way round.

Code:
class MX_Controller extends CI_Controller {}

class MY_Controller extends MX_Controller {}

class Frontend_Controller extends MY_Controller {}

class Article extends Frontend_Controller {}
#3

[eluser]predi[/eluser]
Check this thread >> http://ellislab.com/forums/viewthread/234576/




Theme © iAndrew 2016 - Forum software by © MyBB