MVC-model-view-controller component

On September 26, 2009, in Joomla, PHP, by phpsolutions

General definition:

Input      => Processing => Output
Controller => Model      => View

Model

The model is the part of the component that encapsulates the application’s data. It will often provide routines to manage and manipulate this data in a meaningful way in addition to routines that retrieve the data from the model. In our case, the model will contain methods to add, remove and update information about the books in the database. It will also contain methods to retrieve the list of books from the database. In general, the underlying data access technique should be encapsulated in the model. In this way, if an application is to be moved from a system that utilizes a flat file to store its information to a system that uses a database, the model is the only element that needs to be changed, not the view or the controller.

View

The view is the part of the component that is used to render the data from the model in a manner that is suitable for interaction. For a web-based application, the view would generally be an HTML page that is returned to the data. The view pulls data from the model (which is passed to it from the controller) and feeds the data into a template which is populated and presented to the user. The view does not cause the data to be modified in any way, it only displays data retrieved from the model.

Controller

The controller is responsible for responding to user actions. In the case of a web application, a user action is a page request. The controller will determine what request is being made by the user and respond appropriately by triggering the model to manipulate the data appropriately and passing the model into the view. The controller does not display the data in the model, it only triggers methods in the model which modify the data.

Source:
http://www.vojtechovsky.net/joomla/component-helloworld-2-create-tutorial-guide-en.html

2 Responses to MVC-model-view-controller component

  1. Anonymous says:

    Wow, that’s an incredibly nice read!

  2. Anonymous says:

    I had been very pleased to find this page.I desired to appreciation for an excellent read!! I definitely enjoying every bit of it and that i maybe you’ve bookmarked to look at new stuff you post.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.