开发者

Custom extension not working in Magento

I am writing custom contact us page.When i access the URL http://localhost/dev/contactus/index/ I am getting 404 Not Found error.Here is my config.xml(app/code/local/dZ/ContactUs/etc/) file

<?xml version="1.0"?>
<config>
    <modules>
        <dZ_ContactUs>
            <version>1.0.0</version>
        </dZ_ContactUs>
    </modules>

    <frontend>
        <routers>
            <JustSomeFreeRouterNameHereNo1>
                <use>standard</use>
                <args>
                    <module>dZ_ContactUs</module>
                    <frontName>contactus</frontName>
                </args>
            </JustSomeFreeRouterNameHereNo1>
        </routers>
    </frontend>
</config>

IndexController.php(app/code/local/dZ/ContactUs/controllers)

 <?php 
class dZ_ContactUs_IndexController extends Mage_Core_Controller_Front_Action
{
    public function indexAction()
    {
        var_dump(__METHOD__);
    }
}
?>

and dZ_ContactUs开发者_StackOverflow中文版.xml(app/etc/modules/)

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

Log doesn't show anything.What went wrong?


You should not call your namespace "dZ". It should always start with a capital letter. In your config.xml, in the module tag, you wrote "dZ_ContactUs". Magento will translate that to app/code/local/DZ/ContactUs (mind the capital letter in "DZ"!). Hence, if you rename your Namespace to "Dz" or "DZ", everything should work fine.

Hope this solves your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜