Magento for Developers: Part 3 - Magento Controller Dispatch

The Model-View-Controller (MVC) architecture traces its origins back to the Smalltalk Programming language and Xerox Parc. Since then, there have been many systems that describe their architecture as MVC. Each system is slightly different, but all have the goal of separating data access, business logic, and user-interface code from one another.

The architecture of most PHP MVC frameworks will looks something like this.

  1. A URL is intercepted by a single PHP file (usually called a Front Controller).
  2. This PHP file will examine the URL, and derive a Controller name and an Action name (a process that's often called routing).
  3. The derived Controller is instantiated.
  4. The method name matching the derived Action name is called on the Controller.
  5. This Action method will instantiate and call methods on models, depending on the request variables.
  6. The Action method will also prepare a data structure of information. This data structure is passed on to the view.
  7. The view then renders HTML, using the information in the data structure it has received from the Controller.

摘自:http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-3-magento-controller-dispatch/

posted @ 2014-03-07 17:09  lifeinearth  阅读(130)  评论(0)    收藏  举报