我正在制作一个已启用的Magento模块,我的缓存已关闭。
使用本教程...... http://www.pierrefay.com/magento-create-controller-36
这是我被要求在app/code/local/Pfay/Test
中使用的控制器。
class Pfay_Test_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction ()
{
echo 'test index';
}
public function mamethodeAction ()
{
echo 'test mymethod';
}
}
然而,当我在网络浏览器中转到magento/Pfay/Test/index
时,我得到的是404页面,而不是控制器。
答案 0 :(得分:7)
在复制和粘贴的示例代码中,Pfay_All.xml文件中的以下标记之间有空格:
<active> true </active>
<codePool> local </codePool>
删除这些空格,使标签看起来完全像这样:
<active>true</active>
<codePool>local</codePool>
此外,您使用的路径应为/test/index
或/test
而不是/Test/index
- 即测试中没有大写的T
答案 1 :(得分:1)
尝试以下任何一种代码。
magento/Test/index or magento/Test or magento/test
命名空间仅用于对模块进行分组。
答案 2 :(得分:1)
教程中发现了一些错误
教程说在网址中使用Test
,但网址中不应该是小写,只是小写。
本教程中的另一个错误是<routeurfrontend></routeurfrontend>
代码应该是<test></test>
。您可以在local/Pfay/Test/etc
。
另请阅读其他答案。其他答案很有用,因为编写本教程的人对英语不好,所以阅读起来会让人感到困惑。你会发现他们纠正了第三个错误,所以请查阅。