Create New Layout In Magento

Share

Magento comes in-built with a few page layouts like 1 column, 2 columns with left bar, 2 columns with right bar etc.
If you want to add new layouts of your own follow these steps.

1. Open file /app/etc/local.xml
2. Just before the </global&gt tag add the following






home_page



If you are using the latest version of Magento replace <cms> with <page>. I am not sure from which version this change was made. Just try both and any one will fit (as of now that is :P)

The above xml will do the following –
   a> Add a new layout whose template will be defined in file home-page.phtml using the <template> tag.
   b> The layout will be called homepage.
   c> The name displayed while choosing the layout from the backend will be ‘Home Page’ defined in the <label> tag.
   d> The handle of this page will be ‘home_page’ defined in the <layout_handle> tag.

3. Now create a file at \app\design\frontend\{package_name}\{theme_name}\template\page called home-page.phtml
4. Write the new template layout code in this file.

To make use of this layout –
1. Go to CMS->Manage Pages in the admin.
2. Open the CMS page you want this layout to be applied by clicking preview.
3. Choose ‘Custom Design’ from the left tab.
4. From the ‘Layout’ drop down choose ‘Home Page’

This entry was posted in Magento, PHP and tagged , . Bookmark the permalink.
 

6 Responses to Create New Layout In Magento

  1. alex says:

    Dear Surai, Thank you for this wonderful blog of yours. Hope I could say much than Thank you. This topic saved my ass.

  2. Sumit Surai says:

    Great to know it helped you Alex. Will definitely try and post more such topics.

  3. sukumar says:

    Hi

    This is nice about how should create layout in magento. now magento is popular ecommerce open source site and magento more trade and using in shopping siteMagento ecommerce development

  4. Reynold Hugh says:

    I want to ask that how can I change my layout 2.0 to A 1.0?
    Cre Loaded Templates

  5. Mark says:

    Well said Surai,
    Magento Development has become the choice of many. We can avail a lot of benefits like robust open source platform, live currency update, search engine friendly, easy spreadsheet import and has complete shopping cart functionality in it.

    Magento Design UK

  6. joko says:

    very very thank you Surai.. you’re help me.

Leave a Reply

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

*