Magento’s Request Cycle

September 14, 2009 at 10:45 am 1 comment

Now we will discuss how a browser request to a URL gets translated into module execution. Generally speaking, any URL can be deconstructed like this:
request_url
Magento’s request cycle can be a little confusing to trace through. This is mostly due to the hierarchical nature of the file nesting (routers located under controllers) and the use of the term “dispatch” to mean 3 different things. The front controller “dispatches” the request to its internal list of “routers” and determines if any of the routers “match()” the request’s parameters. If so, then a new MVC Controller (not front-controller) is created from the matching module and, again, the request is “dispatched” to this controller object. The final MVC-style controller is technically a “Front Action”, it houses a number of methods that define the business logic tier.
This new Action object dynamically calls one of its own action methods and marks the request as being “dispatched” (i.e. finished). All these uses of “dispatch” are still different from the event mechanism’s dispatchEvent() method.

imgurlThis directory listing shows all the files (except base Zend Framework files) that
are involved in dispatching a request to the proper module. The directory layout has
nothing to do with the class hierarchy, it is simply a product of class naming and
PHP’s autoloading capabilities.
Core
|- Controller/
| |- Front/
| | |- Action.php
| | ‘- Router.php
| |- Request/
| | ‘- Http.php
| |- Response/
| | ‘- Http.php
| ‘- Varien/
| |- Action.php
| |- Front.php
| ‘- Router/

| |- Abstract.php
| |- Admin.php
| |- Default.php
| ‘- Standard.php

Entry filed under: Magento Basic. Tags: .

Mage Application The AppModel

1 Comment Add your own

  • 1. Margots  |  December 1, 2009 at 9:46 pm

    I wanted to say thank you for these posts. I am learning Magento and your posts help me extremely. It is too bad you have not continued with them since end of Sept

    Thanks again!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent Posts

Categories

Archives

Top Posts

    Top Rated

    Blog Stats

    • 6,373 hits

     

    September 2009
    M T W T F S S
         
     123456
    78910111213
    14151617181920
    21222324252627
    282930  

    Follow

    Get every new post delivered to your Inbox.