Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

custom header on homepage
 
rexford
Jr. Member
 
Total Posts:  2
Joined:  2009-07-23
 

Sorry if this is a stupid question, I’m still figuring out how all the layout pieces fit together. I want to change the header on the home page. The posts I’ve found are about changing the content section.

I see that page.xml specifies the head:

<block type="page/html_head" name="head" as="head">

Is that a reference to .../template/page/html/head.phtml? 
So how does /header.phtml get pulled in?
Is that done in /head.phtml by

$this->getIncludes()
... How does it know what to include?

What I would like to do is pull in one header block and JS if on the homepage, and different header block otherwise.  I don’t know where or how to specify the condition.  If one of you could tell me how, that’s be really great!

Also, is there a resource that might help with this stuff?
Sorry, lots of Q’s I know, still in the “confused” stage.

-Rex

 
Magento Community Magento Community
Magento Community
Magento Community
 
nathus
Sr. Member
 
Total Posts:  93
Joined:  2008-12-13
Twin Cities, MN
 

If you look in the page.xml in the layout folder, the header is defined by

<block type="page/html_header" name="header" as="header">
    <
block type="core/text_list" name="top.menu" as="topMenu"/>
</
block>

The head bock is for what sets the code in the ‘head’ section of the html document.

The template is the header.php file. It’s default is specified in the header block class (code/core/Mage/Page/Html/Header.php)

You should be able to override the header template on the home page by adding the following to the ‘Custom Layout Update’ section of the ‘Custom Design’ tab.

<reference name="header">
    <
action method="setTemplate"><template>page/html/header2.phtml</template></action>
</
reference>
 
Magento Community Magento Community
Magento Community
Magento Community
 
rexford
Jr. Member
 
Total Posts:  2
Joined:  2009-07-23
 

Thanks Jonathon, That worked just perfect.

Here’s what I did incase someone else wants it. I created the homepage specific header template as /template/page/html/header_home.phtml

And then in the admin > CMS > Manage Pages > choose the Home Page, then Custom Design tab,
and added the following in Layout Update XML ...

<reference name="header">
    <
action method="setTemplate"><template>page/html/header_home.phtml</template></action>
</
reference>

Thanks again!
-Rex

 
Magento Community Magento Community
Magento Community
Magento Community
 
skipvicente
Jr. Member
 
Total Posts:  5
Joined:  2012-09-21
 

Its 2012 and your post was very helpfull. I had googled, youtube, and finally found your forum search. I had been breaking my head and with your help I was able to get my custom header working. Thank You SOOOOO much.

Thanks a Million,

Vince

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top