Welcome Guest, Not a member yet? Register   Sign In
MVC pattern -> calling views direct from controller or from controller over a model?
#1

[eluser]F. Albrecht[/eluser]
Hi,

after 6 successful projects with exciting ExpressionEngine I'm turning to CI to getting deeper in that MVC thing Smile

I've just played a little bit with the framework last days and read the docu. Yesterday I've got the book (David Upton) and read some pages. Therefore I have a question:

In my understanding the MVC pattern is working as this:

Code:
Class My_controller

    this->load->my_model
    data = this->my_model->getdata()
    this->load->my_view(data)

Class My_model

    function getdata()


In the book the view call happens via an indirect way like this:

Code:
Class My_controller

    this->load->my_model
    this->my_model->display()

Class My_model

    function display()
        data = this->db->query(anything)
        this->load->my_view(data)


Sorry for my simplified syntax Big Grin

I would prefer the first snippet but I don't know whether it is in the straightfoward MVC theorie? Or does it no matter?


Thanks,

2nd


Messages In This Thread
MVC pattern -> calling views direct from controller or from controller over a model? - by El Forum - 01-05-2008, 02:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB