Welcome Guest, Not a member yet? Register   Sign In
HMVC -> Redecalre error coming application\third_party\MX\Base.php on line 55
#1

[eluser]web_developer[/eluser]
Hello,

Here is my CI 2.0.2 Structure.. I am using latest HMVC modular (5.3)

application
- controllers
- demo.php
- models
- views
- modules
- controllers
- login.php
- models
- login_model.php
- views
- viewLogin.php



here is my main URL

http://www.xyz.com/demo

/demo <-- the main controller

demo.php
Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Demo extends CI_Controller {

  public function __construct(){
    parent::__construct();
  
  public function index(){echo Modules::run('login/main');} // Calling the modules..
}
?&gt;

login/login.php <--- Module controller

Code:
&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

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

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

public function main(){
   echo "YES"; exit;
}
}
?&gt;


when I use MX_Controller then redeclare error is coming.. So I have change with "CI_Controller" then it's working properly.. Even it's loading the view.. But now load model is not working..


i m not getting what is wrong over here.. can any one have an idea?

Notice is coming that "login" is not an object.
#2

[eluser]InsiteFX[/eluser]
I create a MY_Controller that extends MX_Controller then extend my Controllers from the MY_Controller

Code:
/**
* This is the main MY_Controller it is extended from the HMVC MX_Controller.
*
* Any new Controllers would be extended from this Controller, but we have
* already done that by creating the Admin_Controller and the Public_Controller.
*
* Admin_Controller
*
* The Admin_Controller is extended for creating all of our Backend or Dasboard
* Controllers.
*
* Public_Controller
*
* The Public_Controller is extended for creating all of our Frontend Controllers.
*/

class MY_Controller extends MX_Controller {

    // --------------------------------------------------------------------

    /**
     * __construct
     *
     * Class    Constructor PHP 5+ - not need if not setting things
     *
     * @access    public
     * @return    void
     */
    public function __construct()
    {
        parent::__construct();
    }

}

// ------------------------------------------------------------------------
/* End of file MY_Controller.php */
/* Location: ./application/core/MY_Controller.php */


class Admin_Controller extends MY_Controller {

    // --------------------------------------------------------------------

    /**
     * __construct()
     *
     * Class    Constructor PHP 5+ - not need if not setting things
     *
     * @access    public
     * @return    void
     */
    public function __construct()
    {
        parent::__construct();
    }

}

// ------------------------------------------------------------------------
/* End of file Admin_Controller.php */
/* Location: ./application/core/Admin_Controller.php */

class Public_Controller extends MY_Controller {

    // --------------------------------------------------------------------

    /**
     * __construct()
     *
     * Class    Constructor PHP 5+ - not need if not setting things
     *
     * @access    public
     * @return    void
     */
    public function __construct()
    {
        parent::__construct();
    }

}

// ------------------------------------------------------------------------
/* End of file Public_Controller.php */
/* Location: ./application/core/Public_Controller.php */
All of these should be placed in application/core

Also there is a newer version of HMVC modular (5.4)

InsiteFX
#3

[eluser]web_developer[/eluser]
THanks for the reply..

I have notice one more thing..
For first time everything is loading properly (Model, Cotroller & Veiw)
but when I submitting the button then after it is loosing the model object from module controller

$this->login->add <--- Notice is coming that login is not an object.
#4

[eluser]InsiteFX[/eluser]
Did you add this to application/config/config.php at the very bottom?
Code:
$config['modules_locations'] = array(
    APPPATH.'modules/' => '../modules/',
);

Also this is wrong, should be this!
Code:
public function index(){echo modules::run('login/main');} // Calling the modules..

InsiteFX
#5

[eluser]web_developer[/eluser]
yes I have added that too.. but still submit is not working..




Theme © iAndrew 2016 - Forum software by © MyBB