这是我在Magento上的Basetut模块的config.xml上的代码。
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<!--Version của module-->
<Basetut_Memberlog>
<version>0.1.1</version>
</Basetut_Memberlog>
</modules>
<!--Khai báo admin router-->
<admin>
<routers>
<memberlogadmin>
<use>admin</use>
<args>
<module>Basetut_Memberlog</module>
<frontName>memberlogadmin</frontName>
</args>
</memberlogadmin>
</routers>
</admin>
<adminhtml>
<!-- Khai báo file layout trong admin-->
<layout>
<updates>
<memberlog>
<file>memberlog.xml</file>
</memberlog>
</updates>
</layout>
</adminhtml>
<frontend>
<routers>
<memberlog_list>
<use>standard</use>
<args>
<module>Basetut_Memberlog</module>
<frontName>memberlog_list</frontName>
</args>
</memberlog_list>
</routers>
<default>
<router>memberlog_list</router>
</default>
<layout>
<updates>
<memberlog_list>
<file>memberlog.xml</file>
</memberlog_list>
</updates>
</layout>
</frontend>
<global>
<!--Khai báo model, resource model-->
<models>
<memberlog>
<class>Basetut_Memberlog_Model</class>
<resourceModel>memberlog_mysql4</resourceModel>
</memberlog>
<memberlog_mysql4>
<class>Basetut_Memberlog_Model_Mysql4</class>
<entities>
<log>
<table>memberlog</table>
</log>
</entities>
</memberlog_mysql4>
</models>
<!--Khai báo resource để connect và thao tác với database được-->
<resources>
<memberlog_setup>
<setup>
<module>Basetut_Memberlog</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</memberlog_setup>
<memberlog_write>
<connection>
<use>core_write</use>
</connection>
</memberlog_write>
<memberlog_read>
<connection>
<use>core_read</use>
</connection>
</memberlog_read>
</resources>
<!--Khai báo block để có thể dùng được-->
<blocks>
<memberlog>
<class>Basetut_Memberlog_Block</class>
</memberlog>
</blocks>
<!--Khai báo helper-->
<helpers>
<memberlog>
<class>Basetut_Memberlog_Helper</class>
</memberlog>
</helpers>
</global>
</config>
我有一个名为MemberController的控制器。当我在地址上键入此链接http://localhost/magento/index.php/memberlog_list时。这是行不通的。我不知道为什么。这里有什么问题?
答案 0 :(得分:0)
您需要更改代码
..........
<frontend>
<routers>
<memberloglist>
<use>standard</use>
<args>
<module>Basetut_Memberlog</module>
<frontName>memberloglist</frontName>
</args>
</memberloglist>
</routers>
<default>
<router>memberloglist</router>
</default>
</frontend>
...........