UPCOMING: Magento 2 Bootcamp of four days in The Netherlands (April 29th - May 2nd)

November 8, 2009

Video: Custom column layout

Yireo Blog Post

Learn how easy it is to create a custom column layout for Magento. The tutorial is based on the Magento Enterprise Edition but also applies to the Magento Community Edition. A custom column layout is helpful if you want for instance a "left" column to only appear on certain pages.

{youtube d2IX6T-yH2M}

To create a new custom column layout, you need to place a new file in the Magento theme. With the Magento default theme, you could use the folder app/design/frontend/default/default/template/page, but of course - when building your own site - it is recommended to have your own theme-directory.

In the tutorial, the file 1column.phtml is copied to the file 1columnfp.phtml (where "fp" stands for the front page). To make this new page reckognizable you wll need to add a new XML-definition. In the tutorial the following code is added to the file app/code/core/Mage/Page/etc/config.xml.

<one_column_fp module="page" translate="label">
    <label>1 column (frontpage)</label>
    <template>page/1columnfp.phtml</template>
    <layout_handle>page_one_column_fp</layout_handle>
</one_column_fp>

However, with a Magento upgrade this change could be gone. The same XML could also be added to your app/etc/local.xml file instead:

<config>
    <global>
        <page>
            <layouts>
                <one_column_fp module="page" translate="label">
                    <label>1 column (frontpage)</label>
                    <template>page/1columnfp.phtml</template>
                    <layout_handle>page_one_column_fp</layout_handle>
                </one_column_fp>
            </layouts>
        </page>
    </global>
</config>
Posted on November 8, 2009

About the author

Author Jisse Reitsma

Jisse Reitsma is the founder of Yireo, extension developer, developer trainer and 3x Magento Master. His passion is for technology and open source. And he loves talking as well.

Sponsor Yireo

Looking for a training in-house?

Let's get to it!

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.

Do not miss out on what we say

This will be the most interesting spam you have ever read

We don't write too commercial stuff, we focus on the technology (which we love) and we regularly come up with innovative solutions. Via our newsletter, you can keep yourself up to date on all of this coolness. Subscribing only takes seconds.