1

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.

2 Answers 2

3

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(); ?>
1
  • Yes working for me.
    – Mathew
    Commented Dec 14, 2015 at 6:58
1

Write following code in column1.phtml to get top menu :

<?php

$header = new Mage_Page_Block_Html_Header();
echo $header->getChildHtml('topMenu');

?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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