joomla 2.5在模块install.mysql.utf8.sql中的工作原理 [英] joomla 2.5 in module install.mysql.utf8.sql dosent work

查看:89
本文介绍了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:\ xampp \ htdocs \ joom \ modules \ mod_helloworld \ sql \ mysql,而install.mysql.utf8.sql文件为

and sql directory is C:\xampp\htdocs\joom\modules\mod_helloworld\sql\mysql 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.

这篇关于joomla 2.5在模块install.mysql.utf8.sql中的工作原理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆