how to set up folder structure in xml

90 views
Skip to first unread message

Juraj Bevilaqua

unread,
Oct 10, 2022, 11:06:20 AM10/10/22
to Joomla! General Development
hi!
Im learning from a book joomla 4 extension developing
They use extension (component) editing right from joomla core
separately administration/components/com_comname
and components/com_comname
I'm using bot together installing it via zip file
so I have structure like this:
admin
site
sql
My question is how do I set up comname.xml. Can I use files tag multiple times?
Like in exemple here:

<files folder="site">
<folder>src</folder>
<folder>tmpl</folder>
</files>
<files>
<folder>sql</folder>
</files>

<administration>
        <files folder="admin">
            <folder>Extension</folder>
            <folder>services</folder>
            <folder>src</folder>
            <folder>tmpl</folder>
        </files>
</administration>

Is this wrong or correct because I have an error that my database file cant be found (in sql directory).

Thank you for your time, your help will be much appreciated.
Have a nice day!

Viper

unread,
Oct 10, 2022, 2:36:26 PM10/10/22
to Joomla! General Development
Yes, you can use multiple <files>, <folder> under <files> section.
Toy copy and install SQL script you must use <install> section.

Example:
<install>
    <sql>
        <file driver="mysql" charset="utf8">install/sql/mysql/install.sql</file>
        <file driver="mysqli" charset="utf8">install/sql/mysql/install.sql</file>
    </sql>
</install>
where "install/sql/mysql/" folder located under the <administration><files folder="administrator">...</files></administration> ("folder" attribute) in zip file. So path would be "administrator/install/sql/mysql/" in zip file.

Juraj Bevilaqua

unread,
Oct 11, 2022, 6:31:02 AM10/11/22
to Joomla! General Development
Hello again.
Thank you very much for your response.
I have got
<install> <!-- Runs on install -->
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
<uninstall> <!-- Runs on uninstall -->
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>

But I still get error:
JInstaller: :Install: SQL File not found [ROOT]\administrator\components\com_foos/sql/install.mysql.utf8.sql

I have added zip on which Im working on.
Thank you for your help.
Best regards
Juraj
com_foos.zip

Viper

unread,
Oct 11, 2022, 7:34:27 AM10/11/22
to Joomla! General Development
Test zip from attachment.
com_foos.zip

Juraj Bevilaqua

unread,
Oct 12, 2022, 6:26:16 AM10/12/22
to Joomla! General Development
Hello again!
Thanks Viper
I have standard knowledge about php, mostly from udemy.com
This com_foos is from book Joomla 4 developing extension which I have on kindle (amazon reader). This is the step I really need to go forward. But I can hardly understand it now. Can somebody tell me where in the code is defined that sql subfolder have to be in admin folder, please?
Thank you very much.

Viper

unread,
Oct 12, 2022, 6:50:12 AM10/12/22
to Joomla! General Development
Read my first answer carefully(second part).

Juraj Bevilaqua

unread,
Oct 12, 2022, 7:28:27 AM10/12/22
to Joomla! General Development
Hello again!
Did you mean that :
<install>
    <sql>
        <file driver="mysql" charset="utf8">install/sql/mysql/install.sql</file>
        <file driver="mysqli" charset="utf8">install/sql/mysql/install.sql</file>
    </sql>
</install>

Is supposed to be within <administration>  tag? That means that installing sql is administration related?
And why when I debug this I put wrong name adding ss in the name of sql folder like this: And installation is successfull anyway.
<sql>
<file driver="mysqli" charset="utf8">sqlss/install.mysql.utf8.sql</file>
</sql>

Viper

unread,
Oct 12, 2022, 11:03:17 AM10/12/22
to Joomla! General Development
"Is supposed to be within <administration>  tag? That means that installing sql is administration related?"
No.

<files folder="administrator">
change folder name "administrator" to something else.
Reply all
Reply to author
Forward
0 new messages