Welcome Guest, Not a member yet? Register   Sign In
how's models loaded should be in MVC pattern?
#2

[eluser]Phil Sturgeon[/eluser]
Why are you using Models to output headers and footers? Models should not return HTML but should fetch and manipulate data from database, XML, REST, etc.

HTML should go into views.

If you wish to load one model from another, do this:

Code:
class one extends Model {
    function one()
    {
        parent::Model();
    #$this->load->model('two'); # if this line uncommented, everything works just fine
    }

    function get_something(){
        $CI =& get_instance();
        $CI->load->model('two');
        return $CI->two->get_method_two(); #<-- generating error
    }
}


Messages In This Thread
how's models loaded should be in MVC pattern? - by El Forum - 09-08-2009, 03:14 AM
how's models loaded should be in MVC pattern? - by El Forum - 09-08-2009, 08:51 AM
how's models loaded should be in MVC pattern? - by El Forum - 09-08-2009, 11:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB