I need to create a custom admin module and I want to use a template file instead of using a grid. Can someone give me an example of how I would do this. Not sure if it is possible to do this in the controller or if I still need a block and then reference the template there?

1 Answer 1


Based on ModuleCreator patterns we all have made Admin modules with grids, forms, etc... but, at the end, admin environment is like the frontend

Asuming you are familiar with grid block structure & classical Admin modules. You have a controller, which usually calls something like


Then, you define in your layout something like

<reference name="content">
    <block type="yourmodule/adminhtml_yourmodule" name="yourmodule" />

Where your grid should load, etc...

You only need to extend Mage_Adminhtml_Block_Template block in your block yourmodule/adminhtml_yourmodule instead of extending any widget class (as they load their own templates), and then assign a template (in the block constructor, or in the layout, as you preffer)


Define template in block constructor

public function __construct()

Define template in layout

<reference name="content">
    <block type="yourmodule/adminhtml_yourmodule" name="yourmodule" template="xxx/xxx.phtml"/>

As you are extending Mage_Adminhtml_Block_Template you'd place your template into app/design/adminhtml/XX/XX/template folder

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.