2

I have two blocks

<block type="core/template" name="homepage" as="homepage" template="page/html/homepage.phtml" />

<block type="raymanproductstab/productstab" name="productstab" as="productstab" template="productstab/productstab.phtml" />

How can I show these two block only in index page only by modifying layout (but not using backend cms)?

1 Answer 1

9

You have 2 options.
Option 1.
Edit the homepage from CMS->Pages and add your this in the layout update field

<reference name="content">
    <block type="core/template" name="homepage" as="homepage" template="page/html/homepage.phtml" />

    <block type="raymanproductstab/productstab" name="productstab" as="productstab" template="productstab/productstab.phtml" />
</reference>

or add this in the content of the page.

{{block type="core/template" template="page/html/homepage.phtml"}}
{{block type="raymanproductstab/productstab" template="productstab/productstab.phtml"}}

Option 2. Via layout files.

Add this in one of your layout files:

<cms_index_index><!-- layout handle for the homepage -->
    <reference name="content">
        <block type="core/template" name="homepage" as="homepage" template="page/html/homepage.phtml" />
        <block type="raymanproductstab/productstab" name="productstab" as="productstab" template="productstab/productstab.phtml" />
    </reference>
</cms_index_index>

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.