【发布时间】:2014-07-03 06:03:39
【问题描述】:
我刚刚开始使用 magento。我想开发一个显示 helloworld 的简单 magento 扩展。但是当我想通过frontname 访问我的扩展页面时,它总是显示我的404 error。
我在app/local 中创建了一个文件夹Mycompany。然后我创建了一个文件夹Tbc。然后我创建了etc 文件夹并创建了一个config.xml 文件,看起来像
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Tbc>
<version>0.1.0</version>
</Mycompany_Tbc>
</modules>
<frontend>
<routers>
<tbc>
<use>standard</use>
<args>
<module>Mycompany_Tbc</module>
<frontName>tbc</frontName>
</args>
</tbc>
</routers>
<layout>
<updates>
<tbc>
<file>tbc.xml</file>
</tbc>
</updates>
</layout>
</frontend>
</config>
然后我在我的模块目录中创建了一个controllers 目录,并在该目录中创建了一个IndexController.php 文件,如
class Mycompany_Tbc_IndexController extends Mage_Core_Controller_Front_Action {
/**
* index action
*/
public function indexAction() {
echo 'reached here';
die();
}
}
然后我在app/etc/modules 中创建了一个Mycompany_Tbc.xml 文件,看起来像
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Mycompany_Tbc>
<active>true</active>
<codepool>local</codepool>
</Mycompany_Tbc>
</modules>
</config>
我可以在管理面板中看到我的模块已启用。
但是现在我想访问magento.local/tbc 或magento.local/index.php/tbc,它总是给出404 错误。我已安装 this module 以获得更好的 404 错误,并且由于此扩展,404 页面显示
Page not Found
We couldn't find a page at the URL you specified. The information below will help a Magento programmer figure out why.
Original Path
Original Path Information /tbc.
Module/Front Name
Module/Front Name: tbc.
No modules claim [tbc] as a <frontName/>`.
我尝试从头开始创建许多扩展,但多次出现相同的错误并清除缓存。我正在使用magento 1.9
注意我在 localhost 和我的虚拟主机中的 magento.local 上执行此操作。我在安装 magento 后创建了虚拟主机,然后更改 config_cache_data 表中的 web/unsecure/base_url 和 web/secure/base_url。
任何帮助将不胜感激。
【问题讨论】: