Changing the Adminhtml template
This is an old revision of the document!
NOTE - This method won’t change everything relating to the adminhtml template in Magento 1.1.3 (can’t speak for other versions) - the login page and the title of pages (via XML) can’t be altered by using this method, there may be other issues but I don’t know of any. After realising this I used the method decribed in post http://www.magentocommerce.com/boards/viewthread/835/#t7266
To change the AdminHTML Template or Theme, you will need to know how to override Magento’s core modules, and know how the templates in Magento work. This article assumes that you know how to do this. If you do not, please read the appropriate Wiki Articles on the subject before continuing.
Creating a new template inside
design/adminhtml/default/ and placing template files in the folder does not automatically override the default Magento backend theme, nor is there an option in Magento’s backend to change this theme.
To correct this, we must manually instruct Magento that we want to change the selected theme, so that we can use our own template files. To do this, we are going to override a Magento block called
Mage_Adminhtml_Block_Page and use our classes’ construct function to tell Magento that we want to use our own theme.
The class that we are going to be changing is located in
magento/app/code/core/Mage/Adminhtml/Block/Page.php. Create a the new folders required so that you have
/magento/app/code/local/MyCompany/Adminhtml/Block/ available, and copy
Page.php there. (MyCompany can be whatever you want, just make sure that it’s the same the entire time you are going through the steps in this article.)
The next step is the change the class name. Right now your class name is
Mage_Adminhtml_Block_Page, we are going to change it to
MyCompany_Adminhtml_Block_Page. Those of you who have overridden Magento modules before know that we also need to change the class that our new class extends. We are going to do this, but rather than extend our original class, change the extending class to
Mage_Adminhtml_Block_Template. Your class delaration should now read:
class MyCompany_Adminhtml_Block_Page extends Mage_Adminhtml_Block_Template
Now that our class named correctly, we need to actually tell Magento what theme to use. We are going to run one of Magento’s core functions called
setTheme, and we are going to tell it the name of the Theme we want the backend to use. This theme should be the foldername located in
magento/app/design/adminhtml/ and will most likely be called MyCompany. To do this, empty out the class and enter this:
- class MyCompany_Adminhtml_Block_Page extends Mage_Adminhtml_Block_Template
- public function __construct()
magento/app/etc/local.xml. In this file we are going to tell Magento to use our new Class instead of the core class. You should already be familiar with how to do this, but if you are not, here is how:
blocks section of the XML file, it should be located under
config and then
global. In it, enter the following:
Magento should now be looking in the correct folder the backend template files. The best place to start when creating a template for the backend is page.phtml, located in
magento/design/adminhtml/default/default/template/, and of course you know to copy the file to
If you have any comments or questions, you can discuss this article in this thread.