Magento – Magento 1.9 hide nav-bar (top-menu) for new controller in admin page

magento-1.9

I have added the following code in controller page, but still the nav-bar is not hiding..

         $this->loadLayout();
         $this->getLayout()->unsetBlock('header');
         $this->getLayout()->unsetBlock('footer');
         $block = $this->getLayout()->createBlock(
            'Mage_Core_Block_Template',
            'my_block_name_here',
            array('template' => 'ddevs/example_core_block.phtml')
        );

        $this->getLayout()->getBlock('content')->append($block);
        $this->renderLayout();

Best Answer

Better use layout xml for this case. If you want remove menu than you can only set blank template for menu block. If you will remove menu block than you will get fatal error

Fatal error: Call to a member function setActive() on a non-object in /var/www/project/app/code/core/Mage/Adminhtml/Controller/Action.php on line 104

So try use code below and create page/blank.phtml file (of course you can rename this file like you want).

<layout>
    <adminhtml_controller_action>
        <reference name="menu">
            <action method="setTemplate">
                <template>page/blank.phtml</template>
            </action>
        </reference>
        <remove name="footer" />
        <remove name="header" />
    </adminhtml_controller_action>
</layout>
Related Topic