Jul/09
31
How to use different header on same layout
4 Comments · Posted by leo in administration, cms, design, development, magento
Here it goes.
1. Step One
/app/design/frontend/default/default/template/page/html
copy header.phtml to something like header2.html
2. Step Two
/app/design/frontend/default/default/layout
edit page.xml
you can just copy existing Block and change type and name only.
1 2 3 4 5 | <block type="page/html_header2" name="header2" as="header2"> <block type="page/template_links" name="top.links" as="topLinks"/> <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/> <block type="core/text_list" name="top.menu" as="topMenu"/> </block> |
3. Step Three
/app/code/core/Mage/Page/Block/Html
copy Header.php to Header2.php
4. Step Four
Edit Header2.php you will see this code at the begining
1 2 3 4 5 6 | class Mage_Page_Block_Html_Header extends Mage_Core_Block_Template
{
public function _construct()
{
$this->setTemplate(’page/html/header.phtml’);
} |
Change it to
1 2 3 4 5 6 | class Mage_Page_Block_Html_Header2 extends Mage_Core_Block_Template
{
public function _construct()
{
$this->setTemplate(’page/html/header2.phtml’);
} |
You done.
No tags

Edyta · 08/03/2010 at 13:37
Hi!
It doesnt work for me i have
Fatal error: Cannot redeclare class Mage_Page_Block_Html_Header in /home/aonach/public_html/bp/app/code/core/Mage/Page/Block/Html/Header2.php on line 77
Admin comment by admin · 14/03/2010 at 03:12
Sorry, I am not sure which code on your line 77, could you paste a part to me?
Syed Atif Naeem · 25/05/2011 at 07:22
won’t it be better to place a check in header.phtml somewhat like
getIsHomePage()):?> etc ????
will it be a better idea or not ???
amolsingh · 24/12/2011 at 11:16
How to update header for checkout pages?
I dont want to use existing header.