0

How can I insert custom block into the Home Page using custom layout.xml ?

2 Answers 2

2

You can use cms_index_index tag in your layout.xml file and insert your block in your homepage like below.

<cms_index_index>
    <reference name="content">
        <block type="mymodule/myblock" name="myblock" template="mytemplate/myphtml.phtml" /> 
    </reference>
</cms_index_index>
1
  • 1
    Works beautifully :)
    – Rob D. A.
    Commented Sep 11, 2017 at 8:42
1

Go to app/design/frontend/{your package}/{your theme}/layout/local.xml then add this:

<cms_index_index>
    <reference name="content">
        <block type="core/template" name="my.custom.block" template="path/to/template.phtml" />
    </reference>
</cms_index_index>
1
  • I would love to give you both some extra points unfortunately Jaimin was first, Upvote anyway :) thank you ;)
    – Rob D. A.
    Commented Sep 11, 2017 at 8:43

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.