Magento 无法识别自定义模块的路由器
我正在按照此教程来创建自定义模块。由于某种原因,当我点击 http 时,我无法让 magento 识别路由器(我收到 Magento 404 错误) ://exmaple.com/helloworld/index/index。我已验证该模块已在管理员中启用。该配置只有 2 个文件 config.xml 和 IndexController.php。先感谢您!
模块位于 /code/local/Russ/Helloworld
Magento
<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>
/etc/config.xmlcontrollers/IndexController.php
<?php
class Russ_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
echo 'Hello Index!';
}
}
?>
1.6.2
I am following this tutorial to create a custom module. For some reason i can't get magento to recognize the routers( i get a Magento 404 error) when i hit http://exmaple.com/helloworld/index/index. I've verfied that the module is enabled in the Admin. There's only 2 files for this tut config.xml and IndexController.php. Thank you in advance!
Module is in /code/local/Russ/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>
controllers/IndexController.php
<?php
class Russ_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
echo 'Hello Index!';
}
}
?>
Magento 1.6.2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
确保以下 URL 不允许存储代码:
(系统 > 配置 > Web > 将商店代码添加到 URL = 否)
谢谢
Make sure that Store Code is not allowed to the URL:
(System > Configuration > Web > Add Store Code to Urls = No)
Thanks
您是否在 app/etc/modules 中放置了配置文件来激活扩展?您需要此文件来告诉 Magento 您的扩展甚至存在。
尝试将其放入 app/etc/modules/Russ_Helloworld.xml
然后,清除 Magento 的缓存,它应该会拾取它。
Did you put a config file in app/etc/modules to activate the extension? You'll need this file to tell Magento that your extension even exists.
Try put this in app/etc/modules/Russ_Helloworld.xml
Then, clear Magento's cache and it should pick it up.