我试图为我的模块运行安装脚本,这对我来说是第一次,但它没有运行,我可以在core_resource表中找到我的模块。 模块版本是:
<Mdg_Gift>
<version>0.1.0</version>
</Mdg_Gift>
,安装程序名称为:
mysql4安装-0.1.0.php
我在app / code / core / Mage / Core / Model / Resource / Setup.php中找到了这个代码区域
$resModel = (string)$this->_connectionConfig->model;
$modName = (string)$this->_moduleConfig[0]->getName();
$filesDir = Mage::getModuleDir('sql', $modName) . DS . $this->_resourceName;
if (!is_dir($filesDir) || !is_readable($filesDir)) {
return array();
}
并打印出$filesDir
,其值为:
G:\ XAMPP \ XAMPP \ htdocs \ citruss \ app \ code \ \ Mdg \ Gift \ sql \ mdg_gift_setup
路径错误,缺少本地代码池,我不知道该怎么做。 任何帮助将不胜感激,提前谢谢。
更新 config.xml文件是:
<?xml version="1.0"?>
<config>
<modules>
<Mdg_Gift>
<version>0.1.0</version>
</Mdg_Gift>
</modules>
<global>
<models>
<mdg_gift>
<class>Mdg_Gift_Model</class>
<resourceModel>mdg_gift_mysql4</resourceModel>
</mdg_gift>
<mdg_gift_mysql4>
<class>Mdg_Gift_Model_Mysql4</class>
<entities>
<entity>
<table>mdg_gift_entity</table>
</entity>
<item>
<table>mdg_gift_item</table>
</item>
<type>
<table>mdg_gift_type</table>
</type>
</entities>
</mdg_gift_mysql4>
</models>
<blocks>
<mdg_gift>
<class>Mdg_Gift_Block</class>
</mdg_gift>
</blocks>
<helpers>
<mdg_gift>
<class>Mdg_Gift_Helper</class>
</mdg_gift>
</helpers>
<resources>
<mdg_gift_setup>
<setup>
<module>Mdg_Gift</module>
<class>Mdg_Gift_Model_Resource_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mdg_gift_setup>
<mdg_gift_write>
<connection>
<use>core_write</use>
</connection>
</mdg_gift_write>
<mdg_gift_read>
<connection>
<use>core_read</use>
</connection>
</mdg_gift_read>
</resources>
</global>
<frontend>
<routers>
<mdg_gift>
<use>standard</use>
<args>
<module>Mdg_Gift</module>
<frontName>gift</frontName>
</args>
</mdg_gift>
</routers>
</frontend>
</config>
我也无法路由到IndexController.php文件我的代码中是否有任何错误 这是我的IndexController.php文件:
<?php
class Mdg_Gift_IndexController extends Mage_Core_Controller_Front_Action{
public function indexAction()
{
echo 'This is our test controller';
}
}
/app/etc/modules/Mdg_Gift.xml:
<config>
<modules>
<mdg_gift>
<active>true</active>
<codePool>local</codePool>
</mdg_gift>
</modules>
</config>
答案 0 :(得分:1)
在你的etc / modules中,使模块名称为大写,即
<config>
<modules>
<Mdg_Gift>
<active>true</active>
<codePool>local</codePool>
</Mdg_Gift>
</modules>
</config>