I'd like to ask something regarding the MVC pattern.
The controller is responsible for receiving the browser requests and sending them to the model layer.
The view is responsible for reading the request results from the model layer and for preparing and displaying them back to the user.
This output process of the view can be achieved by directly returning the data in some form (string, array, etc), by performing redirects to other website (part), or by just delegating the display to a response instance.
Another important role of the view consists of loading and rendering template files, resp. injecting requested data into the rendered content and returning it back to the browser.
Regarding this last paragraph, I'd like to ask the following:
Is it really so? Should the view have the responsibility of loading and rendering the template files? Or should this task be delegated to an instance of a template class - which will also receive the model data from the view, in order to inject it in the rendered content?
Thank you very much for your patience.
Aucun commentaire:
Enregistrer un commentaire