2

I have installed Magento1.9.3.2, I need to create a custom page layout like 1column,2columns,etc... I have tried something but he doesn't work properly.My frontend design displaying a white page.

My codes

app\design\frontend\MyPackage\MyTheme\layout\page.xml

    <page_home translate="label">
        <label>Home Main</label>
        <reference name="root">
            <action method="setTemplate"><template>pages/home.phtml</template></action>
            <!-- Mark root page block that template is applied -->
            <action method="setIsHandle"><applied>1</applied></action>
        </reference>
    </page_home>

app\design\frontend\MyPackage\MyTheme\template\pages\home.phtml

<div>
    <h1>test</h1>
</div>

Any one help.Advance thanks

2

3 Answers 3

5

To create a new layout page, you have to create a new module like this:

Lets say that your new layout page call 1column-fullwidth

app/etc/modules/Custom_Column1Fullwidth.xml

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

app/code/local/Custom/Column1Fullwidth/etc/config.xml

<?xml version="1.0"?>
    <config>
         <modules>
            <Custom_Column1Fullwidth>
            <version>0.1.0</version>
            </Custom_Column1Fullwidth>
         </modules>
               <global>
                   <page>
                     <layouts>
                        <Column1Fullwidth translate="label">
                               <label>1Column-fullWidth</label>
                                 <template>page/1column-fullwidth.phtml</template>
                               <layout_handle>1column_full_width</layout_handle>
                        </Column1Fullwidth>
                     </layouts>
                   </page>
              </global>
     </config>

app/design/frontend/{package}/{theme}/page/1column-fullwidth.phtml

<!DOCTYPE html>
    <html lang="<?php echo $this->getLang() ?>">
    <head>
    <?php echo $this->getChildHtml('head') ?>
    </head>
    <body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
    <?php echo $this->getChildHtml('after_body_start') ?>
    <div class="wrapper">
        <?php echo $this->getChildHtml('global_notices') ?>
        <div class="page">
            <?php echo $this->getChildHtml('custom_notice') ?>
            <?php echo $this->getChildHtml('header') ?>
            <?php echo $this->getChildHtml('topContainer') ?>
            <div class="main-container col1-layout">
                <div class="main">
                    <div class="col-main">
                        <?php echo $this->getChildHtml('global_messages') ?>
                        <?php echo $this->getChildHtml('content') ?>
                    </div>
                </div>
            </div>
            <?php echo $this->getChildHtml('footer') ?>
            <?php echo $this->getChildHtml('global_cookie_notice') ?>
            <?php echo $this->getChildHtml('before_body_end') ?>
        </div>
    </div>
    <?php echo $this->getAbsoluteFooter() ?>
    </body>
    </html>
8
  • its working. But front end displaying white background.how design my front page.
    – Ravi Kumar
    Apr 13, 2017 at 4:24
  • Yes, realy it displays a white background as default, now if you want to custom this background you have to change it in css
    – PЯINCƎ
    Apr 13, 2017 at 4:30
  • there is no content in my page how to add the content in my page
    – Ravi Kumar
    Apr 13, 2017 at 4:37
  • Your question is that you want to create a new page and put what you want on it, or create a new layout page ? Is not the same thing ?
    – PЯINCƎ
    Apr 13, 2017 at 4:44
  • i need to create new page layout and new page to connect with those two things. Now with your help i have created new page layout now i need to create the custom page .
    – Ravi Kumar
    Apr 13, 2017 at 4:53
2

app/etc/modules/Custompage_Templates.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Custompage_Templates>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Mage_Page />
            </depends>
        </Custompage_Templates>
    </modules>
</config>
3
  • i have change the code like above,but in back end there is no new layout
    – Ravi Kumar
    Apr 12, 2017 at 13:26
  • check your file name, i mean .xml file name
    – Ramesh S
    Apr 12, 2017 at 13:27
  • I have created like this only but its not work
    – Ravi Kumar
    Apr 13, 2017 at 3:57
0

change your layout as below

app\design\frontend\MyPackage\MyTheme\layout\page.xml

<cms_index_index translate="label">
    <label>Home Main</label>
    <reference name="root">
        <action method="setTemplate"><template>pages/home.phtml</template></action>
        <!-- Mark root page block that template is applied -->
        <action method="setIsHandle"><applied>1</applied></action>
    </reference>
</cms_index_index>
3
  • i have change the code like above,but in back end there is no new layout
    – Ravi Kumar
    Apr 12, 2017 at 13:22
  • ohk in backend where you want ? Apr 12, 2017 at 13:33
  • CMS->Pages in pages->layouts
    – Ravi Kumar
    Apr 13, 2017 at 4:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.