To add a new page layout (for example to have a different layout for the homepage) to Magento you need to create a new custom module and add some configuration XML.

Create the module as follows.

  1. In the magento source navigate to the folder etc/modules.
  2. Create a file called Bweb_Layouts.xml    (Bweb can be replaced with whatever namespace you want, but it must be consistently used throughout the rest of the code.
  3. Add the following XML code to the file
    <?xml version="1.0"?>
                <Mage_Page />

This tells Magento to look for an extension module in the local code pool, in the Bweb/Layouts folder.

To configure to module:

  1. Under app/local folder create the folders for Bweb/Layouts/etc
  2. Create a file called config.xml. This file is automatically loaded by Magento when loading a module.
  3. In the config.xml file add the following code.
    <?xml version="1.0"?>
            <home translate="label">   
            <!-- add more layouts here -->

The <home> tag is arbitrary but must not duplicate an existing XML tag or there will be a conflict and Magento may end up using the wrong layout. The <template> tag should contain the path of the template file for the layout relative to the ‘template’ folder in your active theme.

With the files in place, clear the cache, and create a new page or edit an existing page. The new layout should now be available in the layout drop down under the Design tab.

Get our news direct to your inbox

Subscribe to our mail list