1

I want to create a simple module for joomla, that on install will have and install.sql

so I have this xml file:

<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2.0" method="upgrade">

    <name>Address Api</name>
    <!-- The following elements are optional and free of formatting constraints -->
    <creationDate>August 2015</creationDate>
    <author>Tzook Bar Noy</author>
    <authorEmail>tbarnoy@xxxxxx.co.il</authorEmail>
    <authorUrl>http://www.xxxx.com</authorUrl>
    <copyright>Copyright Info</copyright>
    <license>License Info</license>
    <!--  The version string is recorded in the components table -->
    <version>0.0.1</version>
    <!-- The description is optional and defaults to the name -->
    <description>Description of the Hello World component ...</description>



    <files>
        <filename>addressapi.php</filename>
        <filename>ApiCall.php</filename>
        <filename>controller.php</filename>
        <filename>addressapi.xml</filename>
        <folder>site</folder>
        <folder>admin</folder>
    </files>


    <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>
    <update> <!-- Runs on update; New since J2.5 -->
        <schemas>
            <schemapath type="mysql">sql/updates/mysql</schemapath>
        </schemas>
    </update>


    <administration>

        <!-- Administration Main File Copy Section -->
        <!-- Note the folder attribute: This attribute describes the folder
            to copy FROM in the package to install therefore files copied
            in this section are copied from /admin/ in the package -->


    </administration>


</extension>

but when I do the install threw extensions. I get this error:

 JInstaller: :Install: SQL File not found /web/joom/administrator/components/com_addressapi/sql/install.mysql.utf8.sql

so my question is, why it is looking for the sql file inside the administrator/complonents folder, instead of the normal components??

my folders and files structure:

 com_addressapi
     admin
         models
             index.html
         sql
             update
             index.html
             install.mysql.utf8.sql
             uninstall.mysql.utf8.sql
         tables
             index.html
         addressapi.php
         index.html
     site
         addressapi.php
         index.html
     addressapi.xml
     addressapi.php
     ApiCall.php
     controller.php
Tzook Bar Noy
  • 11,337
  • 14
  • 51
  • 82

1 Answers1

1

You got this error because you don't have the sql folder added to your manifest.xml file. You need to include the folder to manifest.xml file.

<folder>sql</folder> 

and your sql folder should have the install.mysql.utf8.sql and uninstall.mysql.utf8.sql with the required script written over there.

MVC component development with proper folder and manifest file structure :

Refrence : Joomla 2.5 Component development https://docs.joomla.org/J2.5:Developing_a_MVC_Component/Adding_an_install-uninstall-update_script_file

Joomla 3.x Component development https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component

Or you can use the component creator for creating a basic Joomla component and then you can change it as per your needs.

http://www.component-creator.com/en/

mickmackusa
  • 43,625
  • 12
  • 83
  • 136
Toretto
  • 4,721
  • 5
  • 27
  • 46
  • just added my folders structure to the post, but i tried to do what you say and still same error.... – Tzook Bar Noy Aug 18 '15 at 07:51
  • @TzookBarNoy you have wrong folder structure and the menifest file please check this link for proper menifest file and component structure. it's just a reference : https://docs.joomla.org/J2.5:Developing_a_MVC_Component/Adding_an_install-uninstall-update_script_file – Toretto Aug 18 '15 at 08:27
  • changed it and stll check the administrator folder , do you have a valid example of component with DB? – Tzook Bar Noy Aug 18 '15 at 10:49
  • As i can see you are using the Joomla 3 and trying to develop the component for that you can use this https://docs.joomla.org/J3.x:Developing_an_MVC_Component/Developing_a_Basic_Component – Toretto Aug 18 '15 at 10:51
  • @TzookBarNoy I have added couple of reference from where you can learn and create the mvc component. – Toretto Aug 18 '15 at 10:55
  • The administrator folder is the correct place to look as you can see by looking at, for example, com_banners. In general use that component as the example. Now the question is, why does the file not seem to be copying to that folder (I assume it isn't). Is it copying somewhere else or not copying at all? – Elin Aug 19 '15 at 02:26