Magento 1.9 – How to Call Menu Design of header.phtml into 1Column.phtml File

designmagento-1.9template

I am working on front end design changes for my website. My requirement to change position of Top Menu design which is written in header.phtml page and i want to use this line into 1Column.phtml page. How can i call this line,

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

on 1column.phtml. So that i can get output.

Best Answer

You can do it by XML in your page.xml or local.xml file of your theme.

<default>
  <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>
</default>

and you can call it in 1column.phtml file

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

Or you can directly call it

<?php echo $this->getLayout()->createBlock('page/html_topmenu')->setTemplate('page/html/topmenu.phtml')->toHtml(); ?>
Related Topic