0

How do I add a layout to the homepage of my site? The homepage content is NOT a full screen and id like to add a full-width banner with a clickable button on it just like what we have here on this site

However, I tried using the static block for this but it didn't work. I am new to Magento and would really appreciate all the help I can get.

12
  • which version you are using and are you using any custom theme or RWD theme?
    – inrsaurabh
    Mar 26, 2018 at 6:20
  • I am using version 1.9 and a custom theme. On the custom theme, they used a cms block. On the content tab, they used some HTML div tags which is by default, in a boxed layout, and on the design tab, they used an XML to call on the slider which is in fullwidth.
    – Daniel
    Mar 26, 2018 at 6:26
  • have a look to this first for magento.stackexchange.com/questions/95643/…
    – inrsaurabh
    Mar 26, 2018 at 6:27
  • I am not looking to make the website fullwidth, just to remove the slider and replace with a banner like the website I referenced above.
    – Daniel
    Mar 26, 2018 at 6:30
  • if you know the xml which is calling the slider than you can remove from that section and to call banner you can use static block and call in the fashion
    – inrsaurabh
    Mar 26, 2018 at 6:32

2 Answers 2

1

How do I add a layout to the homepage of my site?

Suggestion: There is defaults layout which Magento provides which can be easily changed for a page from the backend.

http://magebase.com/magento-tutorials/demystifying-magentos-layout-xml-part-1/

  1. To insert a cms Block directly:

{{block type="cms/block" block_id="your_block_id"}}

  1. You can use widgets for the same

    1. In the Editor toolbar, click on insert Widget
    2. Choose Static Block
    3. Choose the Block you want to insert

In the widget, we can easily call our blocks in the different reference which are created:

inrsaurabh

0

in order to create custom layout for Magento 1.x cms pages you have to create a custom module:

Module directory / file(s) structure :

app/etc/modules/Home_PageFullwidth.xml

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

app/design/frontend/{Theme-Vendor/{Theme-name}/page/home-page.phtml

app/etc/modules/Home_PageFullwidth.xml

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

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

<?xml version="1.0"?>
    <config>
         <modules>
            <Home_PageFullwidth>
            <version>0.1.0</version>
            </Home_PageFullwidth>
         </modules>
               <global>
                   <page>
                     <layouts>
                        <PageFullwidth translate="label">
                               <label>1Column-fullWidth</label>
                                 <template>page/home-page.phtml</template>
                               <layout_handle>homepage_fullwidth</layout_handle>
                        </PageFullwidth>
                     </layouts>
                   </page>
              </global>
     </config>

And finally your template file page/home-page.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>

Your Answer

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

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