I am trying to follow http://alanstorm.com/magento_admin_hello_world_revisited tutorial and setup a custom admin module in magento 1.9.x.
The downloadable boilter plate http://alanstorm.com/2013/projects/Pulsestorm_Adminhello.tar works fine. When its uploaded to magento, I can see the following:
When you click the Example menu item, you see a blank page.
So, I want to now load my own .phtml into the view. So, on the module's config.xml I've added the following:
app/code/community/Pulsestorm/Adminhello/etc/config.xml
<?xml version="1.0"?>
<config>
 ...
 <adminhtml>
 <layout>
 <updates>
 <adminhello>
 <file>adminhello.xml</file>
 </adminhello>
 </updates>
 </layout>
 </adminhtml>
</config>
Then I created the following layout xml file:
app/design/adminhtml/default/default/layout/adminhello.xml
<?xml version="1.0"?>
<layout version="1.0">
 <adminhtml_adminhello_index>
 <block type="core/template" output="toHtml" name="templateBlock" template="adminhello/index.phtml">
 </adminhtml_adminhello_index>
</layout>
Then I created the following template phtml file:
app/design/adminhtml/default/default/template/adminhello/index.phtml
<b>Hello World</b>
When I refresh the page (Pulse Storm -> Example), I still see a blank page. What am I missing here?
3 Answers 3
To show a phtml at layout, you need to add a reference block name <refernece name="Parent_Block_name_At_Layout">
Also, your block is not closed, use / or </block>to close block.
Or you need to set your block name = root instead of templateBlock
Basically...
<?xml version="1.0"?>
<layout version="1.0">
 <adminhtml_adminhello_index>
 <block type="core/template" name="root" template="adminhello/index.phtml"/>
 </adminhtml_adminhello_index>
</layout>
Or
<?xml version="1.0"?>
<layout version="1.0">
 <adminhtml_adminhello_index>
 <reference name="content">
 <block type="core/template" name="templateBlock" template="adminhello/index.phtml"/>
 </reference>
 </adminhtml_adminhello_index>
</layout>
If your Magento version is 1.9.2.2 or less and have applied Magento patch supee-6788, you need to change your url process.
If you have adminhtml.xml for this extension, you need to give permission to access the page.
So, go to System> Permissions> Users. select your user and save.
- 
 Still getting a blank page.Latheesan– Latheesan2016年01月04日 15:19:08 +00:00Commented Jan 4, 2016 at 15:19
- 
 change core/template to adminhtml/template2016年01月04日 15:20:17 +00:00Commented Jan 4, 2016 at 15:20
- 
 Sorry, that didn't help eitherLatheesan– Latheesan2016年01月04日 15:21:20 +00:00Commented Jan 4, 2016 at 15:21
- 
 did you create adminhtml.xml2016年01月04日 15:22:47 +00:00Commented Jan 4, 2016 at 15:22
- 
 Why? In the config.xml, I am referencing<file>adminhello.xml</file>so I have createdadminhello.xml.Latheesan– Latheesan2016年01月04日 15:23:50 +00:00Commented Jan 4, 2016 at 15:23
I think you forgot to put the block in the content reference
<?xml version="1.0"?>
<layout version="1.0">
 <adminhtml_adminhello_index>
 <reference name="content">
 <block type="core/template" name="templateBlock" template="adminhello/index.phtml" />
 </reference>
 </adminhtml_adminhello_index>
</layout>
- 
 Still getting a blank page.Latheesan– Latheesan2016年01月04日 15:19:15 +00:00Commented Jan 4, 2016 at 15:19
- 
 Did you clean the layout cache if it id enabled ? Please remove the attributeoutput="toHtml"to. It is already in output="toHtml" because if it parentcontentMatthéo Geoffray– Matthéo Geoffray2016年01月04日 15:21:19 +00:00Commented Jan 4, 2016 at 15:21
I will try help you partially, at least up until the point where I am stuck following the same tutorial and than going on to add a phtml file...
First of all, the tar file does not include all the stuff you need to get this working, you will need to read through the rest of his tutorial (or see below).
You should have the following files (and content):
app/code/community/Pulsestorm/Adminhello/controllers/AdminhelloController.php
<?php
class Pulsestorm_Adminhello_AdminhelloController extends Mage_Adminhtml_Controller_Action
{
 public function indexAction()
 {
 $this->loadLayout();
 $this->renderLayout();
 }
}
app/code/community/Pulsestorm/Adminhello/etc/adminhtml.xml
<config>
 <menu>
 <pulsestorm translate="title" module="pulsestorm_adminhello">
 <title>Pulse Storm</title>
 <sort_order>1</sort_order>
 <children>
 <example>
 <title>Example</title>
 <sort_order>1</sort_order>
 <action>adminhtml/adminhello/index</action>
 </example>
 </children>
 </pulsestorm>
 </menu>
 <acl>
 <resources>
 <admin>
 <children> 
 <pulsestorm translate="title" module="pulsestorm_adminhello">
 <title>Top Level Pulse Storm Menu Item</title>
 <sort_order>1</sort_order>
 <children>
 <example>
 <title>Example Menu Item</title>
 </example>
 </children>
 </pulsestorm>
 </children>
 </admin>
 </resources>
 </acl>
</config>
app/code/community/Pulsestorm/Adminhello/etc/config.xml
Please note the extra part I added inside adminhtml
<?xml version="1.0"?>
<config>
 <modules>
 <Pulsestorm_Adminhello>
 <version>1.0.0</version>
 </Pulsestorm_Adminhello>
 </modules>
 <adminhtml>
 <layout>
 <updates>
 <pulsestorm_adminhello>
 <file>pulsestorm_adminhello.xml</file>
 </pulsestorm_adminhello>
 </updates>
 </layout>
 </adminhtml>
 <admin>
 <routers>
 <adminhtml>
 <args>
 <modules>
 <Pulsestorm_Adminhello after="Mage_Adminhtml">Pulsestorm_Adminhello</Pulsestorm_Adminhello>
 </modules>
 </args>
 </adminhtml>
 </routers>
 </admin>
 <global>
 <helpers>
 <pulsestorm_adminhello>
 <class>Pulsestorm_Adminhello_Helper</class>
 </pulsestorm_adminhello>
 </helpers>
 </global>
</config>
app/code/community/Pulsestorm/Adminhello/Helper/Data.php
<?php
class Pulsestorm_Adminhello_Helper_Data extends Mage_Core_Helper_Abstract
{
}
'app/etc/modules/Pulsestorm_Adminhello.xml'
<?xml version="1.0"?>
<config>
 <modules>
 <Pulsestorm_Adminhello>
 <active>true</active>
 <codePool>community</codePool>
 <depends></depends>
 </Pulsestorm_Adminhello>
 </modules>
 <admin>
 <routers>
 <adminhtml>
 <args>
 <modules>
 <Pulsestorm_Adminhello after="Mage_Adminhtml">Pulsestorm_Adminhello</Pulsestorm_Adminhello>
 </modules>
 </args>
 </adminhtml>
 </routers>
 </admin>
</config>
app/design/adminhtml/default/layout/pulsestorm_adminhello.xml
<?xml version="1.0"?>
<layout>
 <adminhtml_adminhello_index>
 <block type="core/template" output="toHtml" name="templateBlock" template="adminhello/hello.phtml" />
 </adminhtml_adminhello_index>
</layout>
As you probably guess from the content above you will also need to create a corresponding phtml file under:
app/design/adminhtml/default/template/adminhello/hello.phtml
So for me, I will attach a screenshot of what I now see.
Hope this helps, and perhaps, someone can help get the phtml file rendering in the middle of the admin area, not down near the closing </body> tag.
What I see in my Magento instance (Running 1.9.2.1) 
- 
 If you are having issues, you should post this as a question on its own. Not an answer to similar question maybe.Latheesan– Latheesan2016年03月01日 09:20:13 +00:00Commented Mar 1, 2016 at 9:20
- 
 Fair point, I kinda thought it might get the original questions like 99% solved. So thought it was worth posting to help them.johnsnails– johnsnails2016年03月01日 09:23:33 +00:00Commented Mar 1, 2016 at 9:23
- 
 I don't know if you read this page fully but the question is already answered.Latheesan– Latheesan2016年03月01日 09:26:18 +00:00Commented Mar 1, 2016 at 9:26