Pages

Monday 14 July 2014

Creating Custom Page Layout in Magento

Here is the Solution for creating New Custom Page Layout in Magento. You have to create/customize_existing one Module for this Extra Custom Layout.

Step 1. Create Your Module File called Home_Layout.xml in app/etc/modules

Insert the following code into the file:

<?xml version="1.0"?>
<config>
    <modules>
        <Home_Layout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page/>
            </depends>
        </Home_Layout>
    </modules>
</config>

Step 2. Now create Config File of your Module called config.xml and put this file in the Following directory Structure.

app/code/local/Home/Layout/etc/config.xml

Insert the following code into the file:

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <global>
          <page>
               <layouts>
                    <home_layout module="page" translate="label">
                         <label>Home Page Layout</label>
<template>page/home-layout.phtml</template>
<layout_handle>page_home_layout</layout_handle>
</home_layout>
</layouts>
          </page>
     </global>
</config>


Creating Custom Page Layout in Magento


 Step 3. Now you have to create Template File of your Module called home-layout.phtml and put this file in the Following directory Structure.

app/design/frontend/default/YOUR_THEME/page/home-layout.phtml

Write Your Code Here... For Example

<h1><?php echo "New Custom Page Layout Successfully Created.";?></h1>

Step 4. Finally go to CMS->Pages->Home Page->Design. You can see your New additional Custom Layout in dropdown.

Now Select "Home Layout" and Press Save Page.

Now clear Cache of your store and See the changes on Home Page.

Creating Custom Page Layout in Magento


if you have any queries please live a comment.........

No comments:

Post a Comment