Custom layout template in Magento

Magento as a complete e-commerce package contains “3column template, 2column with right bar, 2column with left bar, 1 column” page templates as default templates that can be applied to the store view pages. Some scenario will appear in which it requires either a completely new layout template for the page or the same template with different customization.

In that case its required to create a new layout template for the page, but as a Magento Extension.

Steps to create the new layout template are as follows:

Step1:
Create a new module in our local folder in Magento, name it as Mage and create a Page module inside it.

app->
code->
local->
Mage->
Page

 
Step2:
As a module structure, Page contains only the etc folder which should contain your config.xml file. Copy the content of app/code/core/Mage/Page/config.xml to app/local/Mage/Page/config.xml.

Step3:
Add the following code at the end of your custom config.xml file

new_layout_template
page/new_layout_template.phtml
page_new_layout_template

 
As mentioned in the above code you need to create a “.phtml” file for the new layout template.

Step4:
Now create a new .phtml file in app/design/yourpackagename/theme/template/page and named its as new_layout_template.phtml and you can define your own layout design.

Step5
Finally you need to tell Magento about your extended module. So create Mage_Local.xml file inside app/etc/module folder add the following code



true
local



 
Now if you go to the cms pages in the design tab under choose a template dropdown it will show you your custom template and on select it will show the custom layout.

Benefits
Creating a folder in local as Mage will not affect the core code. So, whenever you do Magento upgradation it will not over-write this module and will successfully update the core modules.

150 150 Burnignorance | Where Minds Meet And Sparks Fly!