Search code examples
xmle-commercemagento-1.9

Site with different headers in magento?


I am new to magento CMS. My problem is that in my e-commerce project, I have two headers:

1. Homepage Header only for homepage.

2. Normal header for rest of the pages.

I am developing a theme from scratch and I am confused where to have the second header to my rest of the pages. Can anyone help me with this? Thank you in advance!


Solution

  • We have several methods to do this:First of all set header for all pages by editing header.phtml(copy this one to your theme and edit). Then override header of home page(follow the steps below)

    1. Enter to the admin and open the editor of the CMS pages:
    
    2. Open for editing the page “Home page”:
    
    3.Go to the tab “Design”:
    
    4. Add the following text in the section “Layout Update XML”:
    
    <reference name="header">
        <block type="page/header" name="header">
            <action method="setTemplate"><template>page/html/customheader.phtml</template></action> 
        </block> 
    </reference> 
    

    OR

    Add this code to your local.xml

        <cms_index_index translate="label">
          <reference name="header">
        <block type="page/header" name="header">
            <action method="setTemplate"><template>page/html/customheader.phtml</template></action> 
        </block> 
    </reference> 
    </cms_index_index>
    

    Don't forget to create customheader.phtml