-
Notifications
You must be signed in to change notification settings - Fork 0
BasicBackend Task
The BasicBackend task for Joomla components creates a basic MVC for the administrator from a table in a remote MySQL database. In the following example, we use the customers table from the classicmodels database which can be found here. The code we present below is implemented in the Classic models component.
In order for the program to connect to your MySQL database, put your database information in the file "TemplateManifests\config\database.xml". The default database in the "database.xml" file, which connects to db4free.net, is shown below.
<database>
<databaseName>extcreator</databaseName>
<server>db4free.net</server>
<userid>ajoomladeveloper</userid>
<password>vmGmBZJLF42c</password>
<tablePrefix />
</database>
After the database information is set up, the following line of code must be placed under the extension's parameters, with your database's name entered in the databaseName field.
<loadTemplate from="config/database.xml" select="databases/database[databaseName='extcreator']" />
Finally, the following task must be placed after the Main task.
<task name="BasicBackend">
<parameters>
<table>customers</table>
<nameObject>customer</nameObject>
<nameObjectList>customers</nameObjectList>
<canEdit>true</canEdit>
<canCreate>true</canCreate>
<menu>
<menu>true</menu>
</menu>
</parameters>
</task>
Note that table, nameObject, and nameObjectList parameters are required parameters for the task to run correctly. The above code will create MVC files in the administrator part of the site, allowing the user to view, edit, and create entries in the "customers" table from the classicmodels database. Additional customization of the fields extracted from the "customers" table can be made when the extension file is run.