0、在app/etc/modules下聲明配置local中的Ym_hello 的模塊sql
<?xml version="1.0"?>緩存
<config>app
<modules>frontend
<Ym_hello >測試
<active>true</active>spa
<codePool>local</codePool>插件
</Ym_hello>code
</modules>router
</config>xml
一、app/code/local/下建個文件夾爲包名(Ym)記得大寫哦
二、app/code/local/包名/下建個文件夾爲模塊名(hello)
三、在模塊下面建如下目錄統一插件擴展目錄包名下面可創建多個模塊
app/code/local/包名/模塊名/Block
app/code/local/Ym/hello/controllers
app/code/local/Ym/hello/etc
app/code/local/Ym/hello/Helper
app/code/local/Ym/hello/Model
app/code/local/Ym/hello/sql
四、在app/code/local/包名/模塊名/etc下添加config.xml文件
<?xml version="1.0"?>
<config>
<modules>
<Ym_hello>
<version>0.1.0</version>
</Ym_hello>
</modules>
<frontend>
<routers>
<hello>
<use>index</use>
<args>
<module>Ym_hello</module>
<frontName>hell</frontName>
</args>
</hello>
</routers>
</frontend>
<config>
五、(先刪除var/cache緩存)在後臺檢查是否能夠看到插件模塊已經顯示,無顯示則失敗
6,在app/code/local/包名/模塊名/controllers創建控制器
class Ym_hello_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction(){
echo 'Hello magento';
}
}
測試訪問地址:http://域名/模塊名(www.magento.com/模塊名)