Home > Backend Development > PHP Tutorial > Magento execution process?

Magento execution process?

WBOY
Release: 2016-07-29 09:05:07
Original
949 people have browsed it

Magento’s execution process can be fully explained in one picture.

Magento execution process?
Magento is also an MVC model program, but it is different from the ordinary MVC structure.
Let’s look at its program execution process through one of its registrations:
First, we enter http://localhost/magento/index.php/customer/account/create/ in the address bar to enter the registration page.
step 1: When the program gets the customer in the url, it will automatically locate the module app/code/core/Mage/Customer.
step 2: Then when the program gets the account, it will automatically locate the controller file app/code/core/Mage/Customer/ controllers/AccountController.php
step 3: When the program gets create, it will createAction() method in the controller file just found.

<code>public function createAction(){
    if ($this->_getSession()->isLoggedIn()) {
    $this->_redirect('*/*');
    return;
    }
    $this->loadLayout();
    $this->_initLayoutMessages('customer/session');
    $this->renderLayout();
}</code>
Copy after login

step 4: Execute customer.xml under the program loading directory app/design/frontend/base/default/layout/. Then look for the tag named

<code><customer_account_create translate="label">
<label>Customer Account Registration Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
 
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" translate="label">
<label>Form Fields Before</label>
</block>
</block>
</reference>
</customer_account_create></code>
Copy after login

step 5: The block and template to be used are defined in customer. You can use $this to access class methods.
So, Magento’s program execution process can be summarized as follows:
Get the execution controller->Process business logic and model data in the execution method->The controller instantiates the layout object->The layout object instantiates the block according to the request- >Block and template correspond one-to-one to complete the display logic.

The above introduces the execution process of Magento, including various aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template