Welcome Guest, Not a member yet? Register   Sign In
Braking MVC Scheme
#1

[eluser]J. Pavel Espinal[/eluser]
Hello Folks,

After discussing with a friend the way of doing something with CI, he insist that doing something like the example showed in CI user_guide would break the MVC Controller, e.g.

----CI_Example::Model_documentation----
Code:
class Blogmodel extends Model {

    var $title   = '';
    var $content = '';
    var $date    = '';

    function Blogmodel()
    {
        // Call the Model constructor
        parent::Model();
    }
    
    function insert_entry()
    {
        $this->title   = $_POST['title']; // please read the below note
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->insert('entries', $this);
    }

    function update_entry()
    {
        $this->title   = $_POST['title'];
        $this->content = $_POST['content'];
        $this->date    = time();

        $this->db->update('entries', $this, array('id' => $_POST['id']));
    }

}
----CI_Example::Model_documentation END----

As you can see, accessing the data sent by the View (via $_POST) is to brake the MVC scheme as 'The model and controller have no direct knowledge of the view.', I'm I right in this matter?

After reading :
http://en.wikipedia.org/wiki/Model-view-controller

... I'm still not very clear about the subject.




(PS. I'm not native English speaker, please pardon my bad English xD)


Thanks in advice,


Messages In This Thread
Braking MVC Scheme - by El Forum - 03-20-2009, 01:19 PM
Braking MVC Scheme - by El Forum - 03-20-2009, 08:30 PM
Braking MVC Scheme - by El Forum - 03-20-2009, 10:01 PM
Braking MVC Scheme - by El Forum - 03-21-2009, 02:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB