joomla 2.5 模块 install.mysql.utf8.sql 不工作
我想用模块安装外部 sql 文件,我按照这个链接教程 http://docs.joomla.org/J2.5:Creating_a_simple_module/Using_the_Database 但它不起作用.这是我的 xml 和 sql 文件编码.我的错误在哪里?
i want to install extranal sql file with module and i follow this link tutorial http://docs.joomla.org/J2.5:Creating_a_simple_module/Using_the_Database but it dose not work. here is my xml and sql file coding. where is my mistake?
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" version="2.5.0" client="site" method="upgrade">
<name>practic_module</name>
<author>John Doe</author>
<version>1.0.0</version>
<description>this is a practice module struckture</description>
<files>
<filename>mod_helloworld.xml</filename>
<filename module="mod_helloworld">mod_helloworld.php</filename>
<filename>index.html</filename>
<filename>helper.php</filename>
<filename>tmpl/default.php</filename>
<filename>tmpl/index.html</filename>
</files>
<config>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/mysql/install.mysql.utf8.sql</file>
<file driver="sqlazure" charset="utf8">sql/sqlazure/install.sqlazure.utf8.sql</file>
</sql>
</install>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/mysql/uninstall.mysql.utf8.sql</file>
<file driver="sqlazure" charset="utf8">sql/sqlazure/uninstall.sqlazure.utf8.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">sql/mysql/updates</schemapath>
<schemapath type="sqlazure">sql/sqlazure/updates</schemapath>
</schemas>
</update>
<fields name="params">
<fieldset name="basic">
<field name="lang" type="sql" default="1" label="Select a language" query="SELECT id AS value, lang FROM #__helloworld" />
</fieldset>
</fields>
</config>
</extension>
sql 目录是 C:xampphtdocsjoommodulesmod_helloworldsqlmysql 和 install.mysql.utf8.sql 文件是
and sql directory is C:xampphtdocsjoommodulesmod_helloworldsqlmysql and install.mysql.utf8.sql file is
CREATE TABLE IF NOT EXISTS `#__helloworld` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`hello` text NOT NULL,
`lang` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Hello World', 'en-GB');
INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Hola Mundo', 'es-ES');
INSERT INTO `#__helloworld` (`hello`, `lang`) VALUES ('Bonjour tout le monde', 'fr- FR');
但它不起作用.数据库没有安装.我的错在哪里?请帮忙
but it dose not work. database not install. where my mistake? pls help
推荐答案
你需要在 files 标签中包含这些文件,像这样:
You need to include these files in files tag, like this:
<files>
<!-- The others files that you added -->
<filename>sql/mysql/install.mysql.utf8.sql</filename>
<filename>sql/sqlazure/install.sqlazure.utf8.sql</filename>
<filename>sql/mysql/uninstall.mysql.utf8.sql</filename>
<filename>sql/sqlazure/uninstall.sqlazure.utf8.sql</filename>
<filename>sql/sqlazure/updates</filename> <!-- Not sure about this one, sorry -->
</file>
我也在学习,我不知道更新文件是否需要添加文件标签.将此与 Lodder 的回答结合起来.希望有用.
I'm learning too and i don't know if the updates file is necessary to add on files tag. Combine this with Lodder's answer. Hope be useful.
相关文章