Magento : Add Custom Layout Template

Tested in CE and EE

In app/design/frontend/base/<your_theme>/layout/page.xml (CE) or app/design/frontend/enterprise/<your_theme>/layout/page.xml (EE), you will see the custom page layout handles. Just copy any of them.

E.g. :

    <page_empty translate="label">
        <label>All Empty Layout Pages</label>
        <reference name="root">
            <action method="setTemplate"><template>page/empty.phtml</template></action>
            <!-- Mark root page block that template is applied -->
            <action method="setIsHandle"><applied>1</applied></action>
            <action method="setLayoutCode"><name>empty</name></action>
        </reference>
    </page_empty>

I will modify it to :

    <page_homepage translate="label">
        <label>Homepage Layout Page</label>
        <reference name="root">
            <action method="setTemplate"><template>page/homepage.phtml</template></action>
            <!-- Mark root page block that template is applied -->
            <action method="setIsHandle"><applied>1</applied></action>
            <action method="setLayoutCode"><name>homepage</name></action>
        </reference>
    </page_homepage>

Then in app/design/frontend/base/<your_theme>/template/page (CE) or app/design/frontend/enterprise/<your_theme>/template/page (EE), create your custom template. Say homepage.phtml and add the content you need.

After that, you should now be able to access the newly added layout in the Admin panel via CMS->Pages in the design tab of the page you want to edit.

Here's the screenshot :


Comments

Popular posts from this blog

How to fix Cignal Top Box error - Please perform a smart card reset by removing your smart card for 15 seconds then reinsert the card. (1/2)

Magento: can't login to admin panel, can't add product to cart

Magento: How to fix "The requested URL /index.php was not found on this server" error