简体   繁体   中英

My custom Controller not displaying

I am new to magento, I have created a custom controller but it's not getting displayed even though I configured the package in system->configuration->general->design->package .

my code is:

etc/module/easylife_Test.xml file

<?xml version="1.0"?>
<config>
    <modules>
        <EasyLife_Test>
            <active>true</active>
            <codePool>local</codePool>
        </EasyLife_Test>
    </modules>
</config>

local/easylife/Test/etc/config.xml file

<?xml version="1.0"?>
<config>
    <modules>
        <EasyLife_Test>
            <version>0.1.0</version>
        </EasyLife_Test>
    </modules>
    <frontend>
        <routers>
            <test>
                <use>standard</use>
                <args>
                    <module>EasyLife_Test</module>
                    <frontName>test</frontName>
                </args>
            </test>
        </routers>
    </frontend>

</config>

local/easylife/Test/controller/IndexController.php file

<?php

class EasyLife_Test_controller_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        echo "Hello World";
    }
}

I ping protocal://IPAddress/magento/test in URL, but it is returning me a 401 not found error .

may I know what's wrong with this Code?

thanks.

First thing that I noticed is you used package name as: easylife but it should be Easylife. So change easylife_Test.xml to Easylife_Test.xml and local/easylife/Test/etc/config.xml to local/Easylife/Test/etc/config.xml. Then check in your module in admin ->system->configuration->Advanced.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM