1

I have a module. In config.xml i found this code:

 <frontend>
            <layout>
                <updates>
                    <subscription>
                        <file>MailChimp_Subscription.xml</file>
                    </subscription>
                </updates>
            </layout>
    </frontend>

Why we must write it? What I should do, if I want use this module in other layout?

1 Answer 1

2

Layout XML

Layout XML files can be found in app/design/frontend/[package]/[theme]/layout. Each Magento module may define its own layout XML file in the config.xml file.

<frontend>
  <layout>
    <updates>
      <mymodule>
        <file>mymodule.xml</file>
      </mymodule>
    </updates>
  </layout>
</frontend>

Before the page is rendered, Magento loads all configured layout update files and its design updates to determine which block is to be rendered at which location.

source : Complete example on layout

To know in deep read Layout Update If you are creataing template lets say for home page or checkout page than in we define the layouts in our moudle layout file like/var/www/html/psydro16/app/design/frontend/base/default/layout/mymodule.xml`

<cms_index_index translate="label">
..............
  <reference name="bottom.container">
     <block type="mymodule/mymoduletemplate" name="mymodule_mymoduletemplate" template="reviews/mymoduletemplate.phtml" />
..................
 <cms_index_index>

This way we call our module template in that layout.

4
  • Ok, but if i wanna use this module in other layout? Mar 26, 2018 at 10:20
  • @ПавелКушнеревич i updated my suggestion, is that solves your concern
    – inrsaurabh
    Mar 26, 2018 at 10:27
  • @ПавелКушнеревич If it help , you can mark the answer or we will try to update the answer so that it help other community member to follow the right suggestion.
    – inrsaurabh
    Mar 26, 2018 at 10:57
  • @inrasaurabh ty , it help Mar 27, 2018 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.