所以我对模块的最后一点感到非常恼火,我无法在CMS_PAGE表中添加新列。
这是我到目前为止所做的:
/app/code/local/Damian/CMS/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<damian_cms>
<version>0.1.0</version> <!-- Version of module -->
</damian_cms>
</modules>
<global>
<models>
<damian_cms>
<class>Damian_CMS_Model</class>
<resourceModel>cms_mysql4</resourceModel>
</damian_cms>
</models>
<events>
<adminhtml_cms_page_edit_tab_content_prepare_form>
<observers>
<damian_page_edit_tab_content>
<type>singleton</type>
<class>Damian_CMS_Model_Observer</class>
<method>cmsField</method>
</damian_page_edit_tab_content>
</observers>
</adminhtml_cms_page_edit_tab_content_prepare_form>
<cms_page_prepare_save>
<observers>
<damian_cms_save_page>
<type>singleton</type>
<class>Damian_CMS_Model_Observer</class>
<method>savePage</method>
</damian_cms_save_page>
</observers>
</cms_page_prepare_save>
</events>
<resources>
<damian_cms_setup>
<setup>
<module>damian_cms</module>
<class>Damian_CMS_Model_Resource_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</damian_cms_setup>
<cms_write> <!-- It gives the write permission to db -->
<connection>
<use>core_write</use>
</connection>
</cms_write>
<cms_read> <!-- It gives the read permission from db -->
<connection>
<use>core_read</use>
</connection>
</cms_read>
</resources>
</global>
</config>
/app/code/local/Damian/CMS/Model/Resource/Setup.php
<?php
class Damian_CMS_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
}
/app/code/local/Damian/CMS/sql/cms_setup/mysql-install-0.1.0.php
<?php
$installer = $this;
/* @var $installer Mage_Core_Model_Resource_Setup */
echo 'Running This Upgrade:';
die("Exit for now");
$installer->startSetup();
$tableName = $installer->getTable('cms_page');
$installer->getConnection()->addColumn($tableName, 'cms_sitemap', array(
'nullable' => true,
'length' => 255,
'default' => 1,
'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
'comment' => 'added from extension Damian CMS'
));
$installer->endSetup();
我还没有补充其余部分,因为它似乎都工作,但我需要这个安装脚本工作,所以我可以在实时服务器上投入生产,这是本地的,我可以访问我自己的MYSQL数据库,但在实时服务器上,我无法访问MYSQL数据库,所以我必须让这个脚本工作。
感谢您的帮助:)
答案 0 :(得分:0)
好的,所以我让它工作了!
我必须更改模块的名称以匹配我对此的所有
<li class="imgli" style='width:200px;text-align:center;' >
<img id="imgemp" border="0" width="90" height="90">
</li>
然后必须将config.xml中的设置更新为此
<modules>
<Damian_CmsUpdate> <!-- Name had to change to match folder name -->
<version>0.1</version>
</Damian_CmsUpdate>
</modules>