Php – custom module routing is not working in magento

magentoPHPxml

i am a beginner in magento. I have added a custom module and made routing for that custom module. however it is not displaying anything at all, showing a blank page!!!! Not even the page not found message.
here is my code..

my config file is as follows
app/code/local/Test/Test/etc/config.xml

<config>
<modules>
    <Test_Test>
        <version>0.7.1</version>
    </Test_Test>
</modules>
<frontend>
    <routers>
        <test>
            <use>standard</use>
            <args>
                <module>Test_Test</module>
                <frontName>test</frontName>
            </args>
        </test>
    </routers>
<layout>
    <updates>
        <test>
            <file>test.xml</file>
        </test>
    </updates>
</layout>
</frontend>

my Test_Test.xml file in app/etc/modules/Test_Test.xml

<config>
    <modules>
        <Test_Test>
            <active>true</active>
            <codePool>local</codePool>
        </Test_Test>
    </modules>
</config>

my IndexController.php file in app/code/local/Test/Test/controllers/IndexAction.php

<?php
        class Test_Test_IndexController extends Mage_Core_Controller_Front_Action
    {
        public function indexAction()
        {
            $this->getLayout();
            $this->renderLayout();
        }
    }

my test.xml file in app/design/frontend/default/default/layout/test.xml

<layout version="0.7.0">
    <test_index_index>
        <reference name="root">
            <action method="setTemplate">
                <template>page/1column.phtml</template>
            </action>
        </reference>
        <reference name="content">
            <block type="test/view" name="test_index_view" template="test/view.phtml" />
        </reference>
     </test_index_index>
</layout>

my view.phtml file in app/design/frontend/default/default/template/test/view.phtml

<?php 
    echo "test test test test";
?>

i have called the following urls
url 1:

http://localhost:8888/magento/index.php/test/index/index

url 2:

http://localhost:8888/magento/index.php/test/index

url 3:

http://localhost:8888/magento/index.php/test

url 4:

http://localhost:8888/magento/test

all of them shows a blank page as a result. not even showing the '404 not found 1' page . please help me to trigger out the problem. Thanks in advance..

Best Answer

Multiple issues.

  • Your etc/config.xml file is missing a closing </config> tag.
  • You named your controller file IndexAction.php. It must be IndexController.php.
  • Your indexAction should use $this->loadLayout()->renderLayout();.
  • Your layout/test.xml uses an undefined block test/view. Use page/html for now.

After fixing these issues I can see your sample output of view.phtml on a naked 1.7.0.2.

Related Topic