【发布时间】:2017-08-25 04:33:33
【问题描述】:
我正在尝试学习本教程:http://devdocs.magento.com/guides/m1x/magefordev/mage-for-dev-5.html
我使用的是 Magento 1.9.x(不是 2)
我一直在创建一个博客模块,该模块已启用,但路径在我的浏览器中不起作用。
代码/local/Magentotutorial/Weblog/controllers/IndexController.php 中的IndexController.php
<?php
class Magentotutorial_Weblog_IndexController extends
Mage_Core_Controller_Front_Action {
public function testModelAction() {
echo 'Setup!';
}
}
app/etc/modules/Magentotutorial_Weblog.xml 中的 Magentotutorial_Weblog.xml
<config>
<modules>
<Magentotutorial_Weblog>
<active>true</active>
<codePool>local</codePool>
</Magentotutorial_Weblog>
</modules>
app/code/local/Magentotutorial/Weblog/etc/config.xml 中的config.xml
<frontend>
<routers>
<weblog>
<use>standard</use>
<args>
<module>Magentotutorial_Weblog</module>
<frontName>weblog</frontName>
</args>
</weblog>
</routers>
</frontend>
我尝试加载页面http://localhost/MagentoTut/weblog/index/testModel,但出现404 Not Found。我错过了创建模块所需的东西吗?它说我的管理面板中启用了该模块,所以可能路由不正确?
非常感谢。
【问题讨论】:
-
我没有看到你的观点。你的模板在哪里?
-
@NMoeini 我认为 OP 只是试图从控制器显示
echo 'Setup!';。所以视图不存在 -
是的,还没有尝试使用模板。感谢您澄清 B. Desai。