Page 1 of 1

[SOLVED]how to create table with component instalation?

Posted: Tue May 18, 2010 12:34 pm
by sebastian tm
Hi,

i'm trying to make a joomla 1.5 component, but there are some tables that i need to create when installing.

i saw that in joomla 1.0 i would just add in the components xml file, the query between some <queries></queries> tags.

thanks,
sebastian

Re: how to create table with component instalation?

Posted: Tue May 18, 2010 6:47 pm
by dam-man
You can add an install.sql file, this needs to be called by the installer.
This can be added to your XML file during install, it will check if there is a file named install.sql in your backend folder.

<install>
<sql>
<file charset="utf8" driver="mysql">install.sql</file>
</sql>
</install>

<uninstall>
<sql>
<file charset="utf8" driver="mysql">uninstall.sql</file>
</sql>
</uninstall>

Re: how to create table with component instalation?

Posted: Wed May 19, 2010 7:15 am
by sebastian tm
thanks for your help.

i keep getting an error:

*Error! Could not find a Joomla! XML setup file in the package.

I have attached my xml files.
I realy don't know what's wrong with it.

If i remove the SQL part, I receive:

* XML Parsing Error at 27:16. Error 76: Mismatched tag
* Component Install: The XML file did not contain an administration element.

Re: how to create table with component instalation?

Posted: Wed May 19, 2010 5:50 pm
by sebastian tm
i've solved the errors, it seems that you get errors from the zip file.
i used to modify the archive with total commander and kept getting errors.

now every time i want to modify the files before the install i make a fresh new compressed folder with windows' send to ->compressed folder.

and it works.

Re: how to create table with component instalation?

Posted: Wed May 19, 2010 5:53 pm
by sebastian tm
dam-man wrote:You can add an install.sql file, this needs to be called by the installer.
This can be added to your XML file during install, it will check if there is a file named install.sql in your backend folder.

<install>
<sql>
<file charset="utf8" driver="mysql">install.sql</file>
</sql>
</install>

<uninstall>
<sql>
<file charset="utf8" driver="mysql">uninstall.sql</file>
</sql>
</uninstall>
it still doesn't work -,-

Re: how to create table with component instalation?

Posted: Wed May 19, 2010 8:09 pm
by dam-man
Are you have the install files in the zip files and are they uploaded to your server?
This is needed to make it work properly

Re: how to create table with component instalation?

Posted: Thu May 20, 2010 5:38 am
by sebastian tm
It works now. thank you very much.

i thought that the <install> tag should be only once, and the <uninstall> tag at the end.

after the description i added both and worked fine.