The Magento adminhtml (or admin panel) is quite different from other modules for the frontend. The Adminhtml module has a distinct implementation of the Model-Controller-View scheme. In fact, forms, tables, graphs and etc. are usually stereotypical and highly repetitive comparing to the large varieties in the frondend. As a result, in Adminhtml page, such elements are generalized into block ‘widgets’ to boost coding efficiency.
However, when building a new module, we often need to modify the frontend and the backend together. And in many cases, since the we already build the functions in frontend module, it’s really a waste of energy if we have to rewrite everything in terms of ‘widget’ in the backend. Simply, we would like to migrate the controller and view to the backend and reuse the code.
Here, I’m going to go through the basic steps the Mage_Adminhtml_Block_Template rather than widgets.
(This is a developer’s guide.)
Let’s begin with creating a new menu in the Admin panel. We added to the config.xml to our new module:
[codesyntax lang=”xml” lines=”fancy”]
<adminhtml> <menu> <new_module translate="title" module="new_module"> <title>New Module Name</title> <sort_order>50</sort_order> <action>new_module/new_controller</action> </new_module> </menu> </adminhtml>