2012-01-17 124 views
2

我正在关注this教程来创建自定义模块。出于某种原因,当我点击http://exmaple.com/helloworld/index/index时,我无法使用magento识别路由器(我收到Magento 404错误)。我已经确认在Admin中启用了该模块。这个tut config.xml和IndexController.php只有两个文件。先谢谢你!自定义模块路由器不被Magento识别

模块处于/代码/本地/拉斯/的Helloworld

/etc/config.xml

<config> 
    <modules> 
     <Russ_Helloworld> 
      <version>0.1.0</version> 
     </Russ_Helloworld> 
    </modules> 

    <frontend> 
     <routers> 
      <helloworld> 
       <use>standard</use> 
       <args> 
        <module>Russ_Helloworld</module> 
        <frontName>helloworld</frontName> 
       </args> 
      </helloworld> 
     </routers> 
    </frontend> 

</config> 

控制器/ IndexController.php

<?php 

class Russ_Helloworld_IndexController extends Mage_Core_Controller_Front_Action { 
    public function indexAction() { 
     echo 'Hello Index!'; 
    } 

} 

?> 

的Magento 1.6.2

+1

您是否将文件添加到应用程序/ etc/modules? – 2012-01-17 04:55:23

+0

是的,我做到了。我能够在管理员的其他模块中看到自定义模块,并且已启用 – russjman 2012-01-17 04:57:39

+2

在config.xml中中断XML并打开开发人员模式(请参阅index.php)。验证分析错误。 – benmarks 2012-01-17 05:18:03

回答

3

确保商店代码不被允许访问网址:
(系统>配置>网络>添加商店代码到URL =否)

感谢

+0

好像2小时后浪费我的生活这是我的问题,仍然相关4年。 – rchatburn 2016-04-25 14:39:03

+0

有谁知道这是为什么?它也解决了我的问题,但我只是想知道为什么,我搜索了代码库,但无法追踪它。 – 2016-05-02 13:52:40

1

你投入应用的配置文件/ etc /模块激活扩展?你需要这个文件告诉Magento你的扩展程序甚至存在。

尽量把这个应用程序中的/ etc /模块/ Russ_Helloworld.xml

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

然后,清除Magento的缓存,它应该把它捡起来。