Magento – show .phtml file in admin custom module

adminhtmlmagento-1.9module

Hi i see this question a few times here but i can't solve my error, i got well until the blank page in my admin custom module, I follow this tutorial. So can somebody tell me the right direction i got almost a week trying to solve this.

My files are:

  • app\code\local\meteorify\observerexample\controllers\observerexamplecontroller.php
  • app\code\local\Meteorify\Observerexample\etc\adminhtml.xml
  • app\code\local\meteorify\observerexample\etc\config.xml
  • app\code\local\Meteorify\Observerexample\Helper\Data.php (empty)
  • app\etc\modules\Meteorify_Observerexample.xml
  • app\design\adminhtml\default\default\layout\icommkt_email.xml
  • app\design\adminhtml\default\default\template\observerexample\index.phtml

The content of the files are:

observerexamplecontroller.php

<?php
     class Meteorify_Observerexample_ObserverexampleController extends  Mage_Adminhtml_Controller_Action
    {
        public function indexAction()
        {
            $this->loadLayout();
            $this->renderLayout();
        }
    }   

adminhtml.xml

<?xml version="1.0" encoding="utf-8" ?>
<config>
  <menu>
    <Meteorify_Observerexample translate="title" module="Meteorify_Observerexample">
      <title>Icommkt</title>
      <sort_order>1</sort_order>
      <children>
        <example>
          <title>Email</title>
          <sort_order>1</sort_order>
          <action>adminhtml/Observerexample/index</action>
        </example>
      </children>
    </Meteorify_Observerexample>
</menu>
  <acl>
    <resources>
      <admin>
        <children>
          <Meteorify_Observerexample translate="title" module="Meteorify_Observerexample">
            <title>Top Level Icommkt Menu Item</title>
            <sort_order>1</sort_order>
            <children>
              <example>
                  <title>Example Menu Item</title>
              </example>
            </children>
          </Meteorify_Observerexample>
        </children>
      </admin>
    </resources>
  </acl>
  <layout>
    <updates>
      <Meteorify_Observerexample>
        <file>Icommkt_Email.xml</file>
      </Meteorify_Observerexample>
    </updates>
  </layout>
</config>

config.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
  <modules>
    <Meteorify_Observerexample>
      <version>0.0.1</version>
    </Meteorify_Observerexample>
  </modules>
  <global>
    <models>
      <meteorifyobserverexample>
        <class>Observerexample_Model</class>
      </meteorifyobserverexample>
    </models>
    <events>
      <customer_register_success>
        <observers>
          <meteorify_observerexample_model_observer>
            <class>Meteorify_Observerexample_Model_Observer</class>
            <method>example</method>
            <type>singleton</type>
          </meteorify_observerexample_model_observer>
        </observers>
      </customer_register_success>
      <checkout_submit_all_after>
        <observers>
          <meteorify_observerexample_model_observer>
            <class>Meteorify_Observerexample_Model_Observer</class>
            <method>example</method>
            <type>singleton</type>
          </meteorify_observerexample_model_observer>
        </observers>
      </checkout_submit_all_after>
    <customer_address_save_after>
        <observers>
            <meteorify_observerexample_model_observer>
                <class>Meteorify_Observerexample_Model_Observer</class>
                <method>onCustomerAddressSaveAfter</method>
                <type>singleton</type>
            </meteorify_observerexample_model_observer>
        </observers>
    </customer_address_save_after>
    </events>
    <helpers>
      <Meteorify_Observerexample>
        <class>Meteorify_Observerexample_Helper</class>
      </Meteorify_Observerexample>
    </helpers>
  </global>
  <admin>
      <routers>
        <adminhtml>
          <args>
            <modules>
              <Meteorify_Observerexample after="Mage_Adminhtml">Meteorify_Observerexample</Meteorify_Observerexample>       
          </modules>
          </args>
        </adminhtml>
      </routers>
    </admin>
</config>

Meteorify_Observerexample.xml

<?xml version="1.0" encoding="utf-8"?>
<config>
    <modules>
        <Meteorify_Observerexample>
            <codePool>local</codePool>
            <active>true</active>
        </Meteorify_Observerexample>
    </modules>
</config>

icommkt_email.xml

<layout version="0.1.0">
  <adminhtml_meteorify_observerexample_observerexample_index>
    <update handle="admin_index"/>
    <reference name="content">
      <block type="core/template" name="Meteorify_Observerexample" template="observerexample/index.phtml" />
    </reference>
  </adminhtml_meteorify_observerexample_observerexample_index>
</layout>

Here index.phtml is a simple Hello world, but i got only a blank page with no errors. So can anyone tell me what are the errors with Magento here?

Update 1

in the image below is how looks after try the method 2
Method 2

Best Answer

I think you have problem with your handler in icommkt_email.xml file.

Method 1:

You can print handler in your via your controller by print_r($this->getLayout()->getUpdate()->getHandles()) in array[3] you get handler just replace it with
adminhtml_meteorify_observerexample_observerexample_index and try again

method 2:

print core/template directly adding in your controller indexAction by adding below code

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('observerexample/index.phtml')->toHtml() ?>