0

I'm new to Magento i have a bit of a problem i have 4 pages e.g home about etc... all these pages use the same header, i have created another header and updated in the page.xml file, from what i gathered the header and all the other stuff are being called from 1column.phtml. How do i do this so when you click a different page it can change header.

basically i want this code underneath to change when a different page is loaded.

<head>
 <?php echo $this->getChildHtml('head') ?>
</head>

to

<head>
 <?php echo $this->getChildHtml('head-about') ?>
</head>

this is the part of the page.xml file which i have modified.

 <block type="page/html_header" name="header" as="header">
            <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" translate="label">
                <label>Navigation Bar</label>
                <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
            </block>
            <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
                <label>Page Header</label>
                <action method="setElementClass"><value>top-container</value></action>
            </block>
            <block type="page/html_welcome" name="welcome" as="welcome"/>
        </block>


                    <block type="page/html_header" name="header-about" as="header-about">
            <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" translate="label">
                <label>Navigation Bar</label>
                <block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"/>
            </block>
            <block type="page/html_wrapper" name="top.container" as="topContainer" translate="label">
                <label>Page Header</label>
                <action method="setElementClass"><value>top-container</value></action>
            </block>
            <block type="page/html_welcome" name="welcome" as="welcome"/>
        </block>
  • Better if you can share the page.xml - the modified section – Nidheesh Oct 4 '16 at 10:54
0

If you want to different header on CMS page then you can achieve by:

In CMS->Design->Layout Update XML put this code:

   <reference name="header">
    <block type="page/header" name="header">
        <action method="setTemplate"><template>cms/headers/about_us.phtml</template></action> 
    </block> 
</reference> 

And create file about_us.phtml your_theme/template/cms/headers It's done.

For more see here.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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