Welcome Guest, Not a member yet? Register   Sign In
How to call Model (used HMVC)
#10

[eluser]wortell[/eluser]
[quote author="d0ri0" date="1284668886"]I got : Fatal error: Call to undefined method MX_Controller::MX_Controller() in C:\wamp\www\cms\application\modules\map\controllers\map.php

But when removing the line parent::MX_Controller(); it worked. And the model could be used.

So, thanks for helping![/quote]


*bump!* pls?
me too, same issue...

CI 2.0, HMVC 5.3+, PHP 5.3+

my test...

/modules/welcome/

Code:
class Welcome extends Controller {

    function Welcome() {
       parent::Controller();
       $this->load->model("welcome_model");

       // ** DOES NOT! ** print out 'help!' accordingly
       print_r($this->welcome_model->get_greetee());

       $this->output->cache(CACHE_LIMIT);
    }

    function index() {
        echo "retrieved: ".$this->welcome_model->get_greetee();
        $this->load->view('welcome_message');
    }
}

Code:
class Welcome_model extends CI_Model {


    function welcome_model(){
        // Call the Model constructor
        parent::CI_Model();

        // prints out 'help!' accordingly
       echo $this->get_greetee();
    }

    function get_greetee(){
        echo "help!<br>";
    }

}


Messages In This Thread
How to call Model (used HMVC) - by El Forum - 09-16-2010, 04:46 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 06:19 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 08:08 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 08:43 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 09:17 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 09:28 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 10:17 AM
How to call Model (used HMVC) - by El Forum - 09-16-2010, 02:10 PM
How to call Model (used HMVC) - by El Forum - 09-17-2010, 05:35 AM
How to call Model (used HMVC) - by El Forum - 09-20-2010, 06:51 PM
How to call Model (used HMVC) - by El Forum - 09-21-2010, 05:23 AM
How to call Model (used HMVC) - by El Forum - 09-21-2010, 06:25 AM
How to call Model (used HMVC) - by El Forum - 09-21-2010, 06:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB