I created adminhtml controller under practice->test->controllers->adminhtml->indexController.php it's working fine. But I created one menu in back-end and it's showing when I click on menu i created action to redirect my custom afficher.phtml, it's not redirecting given 401 error.

can anyone tell me where I went wrong?

my code is



class Practice_Test_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action
    public function indexAction()
        //echo 'admin test';


            <test translate="title" module="adminhtml">
                <title>My Plugin</title>
                        <title>Address Book</title>


<?xml version="1.0"?>
<layout version="0.1.0">
        <reference name="content">
            <block name="template1" type="test/template" template="test/afficher.phtml"></block>


<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>"  />

    Admin Html

thanks in advance.


In your indexAction() , you have not called any block and phtml file to show. Write you function like this

public function indexAction()
       $block = $this->getLayout()->createBlock('module/folder_blockName')->setTemplate("FolderName/File.phtml");
       $this->_setActiveMenu('menu/children'); // to set the menu item active


This part of the config:


should actually be


This is why the change is necessary. Consider when given the action of practiceadmin/adminhtml_index, the first half is translated into Practice_Test_Adminhtml and the second half is translated into Adminhtml_IndexController then the two parts are joined together. The resulting class name has Adminhtml in it twice.

  • hi clockworkgeek, my afficher.phtml file is not showing. it is showing empty page with menu items – Manoj Kumar Oct 9 '13 at 11:28
  • Your layout says template="test/afficher.phtml" but the created file is Practice/test/afficher.phtml. Change either one of those to match the other. – clockworkgeek Oct 9 '13 at 12:15

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.