0

I need to create custom module so I have written some code but my phtml is not loading by block.. I need to load that on action url, but thats not loading... I'm giving here my module detail. the whole thing is good but my template phtml file is not showing on show action

my config.xml
-----------
<?xml version="1.0" encoding="utf-8"?>
<config>
    <modules>
        <Nine_Magazine>
            <version>0.1.0</version>
        </Nine_Magazine>
    </modules>
    <global>
        <models>
            <nine_magazine>
                <class>Nine_Magazine_Model</class>
            </nine_magazine>
        </models>
        <blocks>
            <nine_magazine>
                <class>Nine_Magazine_Block</class>
            </nine_magazine>
        </blocks>
        <helpers>
            <nine_magazine>
                <class>Nine_Magazine_Helper</class>
            </nine_magazine>
        </helpers>
      <!--  <resources>
            <nine_magazine_setup>
                <setup>
                    <module>Nine_Magazine</module>
                    <class>Nine_Magazine_Model_Resource_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </nine_magazine_setup>
            <nine_magazine_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </nine_magazine_write>
            <nine_magazine_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </nine_magazine_read>

        </resources>-->
        <models>
            <nine_magazine>
                <class>Nine_Magazine_Model</class>
                <resourceModel>nine_magazine_mysql4</resourceModel>
            </nine_magazine>
            <nine_magazine_mysql4>
                <class>Nine_Magazine_Model_Mysql4</class>
                <entities>
                    <magazine>
                        <table>nine_magazine_entity</table>
                    </magazine>
                </entities>
            </nine_magazine_mysql4>

        </models>
    </global>
    <frontend>
        <routers>
            <nine_magazine>
                <use>standard</use>
                <args>
                    <module>Nine_Magazine</module>
                    <frontName>magazine</frontName>
                </args>
            </nine_magazine>
        </routers>
        <layout>
            <updates>
                <nine_magazine module="nine_magazine">
                    <file>nine_magazine.xml</file>
                </nine_magazine>
            </updates>
        </layout>
    </frontend>
</config>

my controller
-----------------
<?php

class Nine_Magazine_MagazineController extends Mage_Core_Controller_Front_Action {



     public function showAction() {
        //echo 'test';exit;
        $this->loadLayout();
        $this->renderLayout();

    }
        }

my block

------
<?php

class Nine_Magazine_Block_Show extends Mage_Core_Block_Template {


}

my nine_magazine.xml

-------------
<?xml version="1.0"?>
<layout version="0.1.0"> 
    <nine_magazine_magazine_show translate="label">
        <label>Magazine</label>
        <!-- Mage_Customer -->
        <remove name="right"/>
        <remove name="left"/>

        <reference name="root">
            <action method="setTemplate">
                <template>page/1column.phtml</template>
            </action>
        </reference>
        <reference name="content">
            <block type="magazine/show" name="magazine_show" template="magazine/magazine.phtml"></block>
        </reference>
    </nine_magazine_magazine_show>
</layout>
1

Your block type in nine_magazine.xml should be:

<block type="nine_magazine/show"

because you declared it this way:

<blocks>
    <nine_magazine>
        <class>Nine_Magazine_Block</class>
    </nine_magazine>
</blocks>

Also please see if there are some errors in var/log.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.