1

I have succesfully created a custom module and added menu also on clicking it redirects to the controller index action where it displays the header and footer section , but I didn't figure out how can I add some phtml file to it . I basically want to show data from my custom table there .

This is etc/config.xml file

<?xml version="1.0"?>
<config>
    <modules>
        <Ilogix_Regionbased>
            <version>0.1.0</version>
        </Ilogix_Regionbased>
    </modules>
    <frontend>
        <routers>
            <regionbased>
                <use>standard</use>
                <args>
                    <module>Ilogix_Regionbased</module>
                    <frontName>ilogix_regionbased</frontName>
                </args>
            </regionbased>
        </routers>
    </frontend>
    <admin>
        <routers>
            <regionbased>
                <use>admin</use>
                <args>
                    <module>Ilogix_Regionbased</module>
                    <frontName>ilogix_regionbased</frontName>
                </args>
            </regionbased>
        </routers>
    </admin>
    <global>
        <helpers>
            <regionbased>
                <class>Ilogix_Regionbased_Helper</class>
            </regionbased>
        </helpers>
    </global>
    <adminhtml>
        <layout>
            <updates>
                <regionbased>
                    <file>regionbased.xml</file>
                </regionbased>
            </updates>
        </layout>
        <menu>
            <catalog module="adminhtml">
                <children>
                    <regionbased module="regionbased">
                        <title>Regions</title>
                        <sort_order>181</sort_order>
                        <action>ilogix_regionbased/adminhtml_index</action>
                    </regionbased>
                </children>
        </catalog>
        </menu>
    </adminhtml>
</config>

This is my Admin side controller Regionbased/controllers/Adminhtml/IndexController.php

class Ilogix_Regionbased_Adminhtml_IndexController extends Mage_Adminhtml_Controller_Action {

    /**
     * Admin controller index action
     *
     * @access public
     * @return void
     */

    public function indexAction() {
        $this->loadLayout();
        $this->renderLayout();

    }
}

this is design/adminhtml/default/default/layout/regionbased.xml file

<adminhtml_regionbased_index>
    <block type="core/template" output="toHtml" name="templateBlock" template="regionbased/regionbased.phtml"></block>
</adminhtml_regionbased_index>

This is phtml file

app/design/adminhtml/default/default/template/regionbased/regionbased.phtml

<h1>Hello</h1>

I am not able to figure out how can i access this phtml file when the indexcontrollers index method get called .

Looking forward for your help .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.