Braking MVC Scheme |
[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 { 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,
[eluser]jedd[/eluser]
Hi Jose, Well, the model should certainly have no idea about the view (and vice versa). The controller has to have an understanding of the view - it sends data to, and retrieves it back from, it. There's some [url="http://ellislab.com/codeigniter/user-guide/overview/appflow.html"]good information in the CI User Guide[/url] - that link in particular will take you to a graphic showing the flow of information.
[eluser]Colin Williams[/eluser]
Wait wait wait wait... So your friend thinks that the Controller accessing $_POST data that was sent by a View is bad MVC? Has he (she) ever programmed for the web? Or client/server at all? For all the view is concerned, it is POSTing data (or GETting, PUTting, DELETEing, etc) to a URI. The fact that there is a controller for that request creates no "knowledge" of the controller from the view's perspective.
[eluser]jalalski[/eluser]
And from the Model's point of view, it is making use of a (global) array of data, with no knowledge of where it came from. However, I would prefer not to make use of the global variables in Model. Better to pass an array in to the functions as a parameter. |
Welcome Guest, Not a member yet? Register Sign In |