打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Magento 1.8.0.0 创建你的第一个模块


自己在创建第一个模块时,用了三天,心塞!!国内的文章太少了。跑去看英文!




1. 创建以下目录(有些暂时用不到,先创建起来)


app/code/local/Test/Mymodule/Block   

app/code/local/Test/Mymodule/controllers  

app/code/local/Test/Mymodule/etc  

app/code/local/Test/Mymodule/Helper  

app/code/local/Test/Mymodule/Model  

app/code/local/Test/Mymodule/sql  




2. 创建config.xml

/app/code/local/Test/Mymodule/etc/config.xml

<?xml version="1.0" encoding="utf-8"?> <config>         <modules>         <Test_Mymodule>             <version>0.1.0</version>         </Test_Mymodule>     </modules>      <!-- This node contains parameters, available on frontend -->     <frontend>         <!-- Module aliases are located in this block -->         <routers>             <!-- This node's name should be the same as our alias -->             <Mymodule>                 <!-- use parameter specifies which of basic routers needs to be used.                 This can be "standard" for frontend or "admin" for backend -->                 <use>standard</use>                 <!-- router arguments block -->                 <args>                     <!-- This parameter specifies the full name of out module -->                     <module>Test_Mymodule</module>                     <!-- This parameter sets module alias -->                     <frontName>mymodule</frontName>                 </args>             </Mymodule>         </routers>       <layout>             <updates>                                <helloworld>                                         <file>mymodule.xml</file>                 </helloworld>             </updates>         </layout>     </frontend> </config>  

3. 创建Test_Mymodule.xml

/app/etc/modules/Test_Mymodule.xml

<?xml version="1.0" encoding="utf-8"?> <config>         <modules>         <Test_Mymodule>            <active>true</active>            <codePool>local</codePool>         </Test_Mymodule>     </modules> </config> 

4. 创建IndexController.php控制器

/app/code/local/Test/Mymodule/controllers/IndexController.php

class Test_Mymodule_IndexController extends Mage_Core_Controller_Front_Action {    public function indexAction()     {      echo "test";     } }


5. 如果没有在后台开启url重写的话,打开模块的url为:


http://example.com/index.php/mymodule/index/index



本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
linuxmint 17 输入法安装
luci_theme and module
Ubuntu14.04安装搜狗拼音输入法-sogoupinyin
如何在Debian 9上安装中文输入法 | linux资讯
定制Magento模板
C#_WinForm程序的App.Config数据库连接配置文件
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服