Magento – Add new layout

This is the first in a, hopefully, useful series of quick how-tos for Magento. All of them will be referencing Magento 1.4.1.1.

To add a new layout to Magento that is available in the CMS you’ll need to edit

app/etc/local.xml

To insert the <page> element like:

<config>
    <global>
        <page>
            <layouts>
                <three_box module="page" translate="label">
                    <label>3 box</label>
                    <template>page/3box.phtml</template>
                    <layout_handle>page_three_box</layout_handle>
                </three_box>
            </layouts>
        </page>
    </global>
</config>

To make the layout default you can also add

<is_default>1</is_default>

The layout can now be selected in the CMS as “3 box”. It will use the page/3box.phtml to render in whatever theme you are using. For example:

app/design/frontend/base/default/my_theme/template/page/3box.phtml

To reference the new layout in your layout XML files you use the <layout_handle> value. In our example, <page_three_box>.

Leave a Reply

Your email address will not be published. Required fields are marked *