Codeigniter HMVC Re-Declare error coming

I am using CI 2.0.2 and using the 5.4 modular extension.

I have a user as the default controller.

class User extends CI_Controller{

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

 public function login{ echo modules::run('login/main'); }
}

Here are my modules / login / controller

class Login extends MX_Controller{

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

  $this->load->model('login_model','login');
 } 

  public function main{
     $arrUserInfo = $this->login->getUserInfo();
  }
}

If I use "MX_Controller", then I get below the error Fatal error: Unable to override CI class in E: \ Projects \ mySite \ application \ third_party \ MX \ Base.php on line 55

So, I have changes with "CI_Controller", after which I get below the error

An error was found. Cannot find the specified model: login_model

I do not understand why modular MVC does not work. If anyone has an idea, please share it. thank..

+3
source share
3 answers

, . User MX_Controller, CI_Controller:

class User extends MX_Controller
{
    public function __construct(){
        parent::__construct();
    } 

    public function login { echo modules::run('login/main'); }
}

-, , , MX_Controller, .

+11

Module::run weithin Views. :

$this->load->module('folder/controller');
$this->controller->method();
+2

In addition, when loading models, you must specify the name of the module.

i.e. $this->load->model('login/login_model','login');

0
source

All Articles