Just another component creator
Before the first line of code is written, a data model must be developed. Normally this model will later be represented in the database.
For instance I use MySQL Workbench for developing the data model. The tool is able to export tables directly into a database.
Jacc uses these tables, and expects that each table (as far as there exists a primary key) represents a triple of a Model View Control.
So before you use Jacc, be sure that there are tables in the Joomla database, which corresponds to your data model. For a little test you can try the sql script for an example bookshop.
- Import your tables into the Joomla database
- Go to Jacc->Components and edit the Preferences.
- Click New. The Jacc Component Editor will be displayed.
- Enter title and version, select your tables and click Save. Your Component appears now in the components list
- Copy the link in the column Download, paste it in the URL-Installation Field of the Joomla Installation Manager and install the component.
If you have respected the suggested naming rules for the table columns, you will have a working but rudimental backend administration and frontend for your component. You can start now developement.
Warning: If you want to repeat the procedure, use Jacc to recreate the component before reinstalling or backup tables structure before deinstallation of the component.
Guidelines and Recommendations¶
Use the underscore to indicate the relation between your tables. M.e. if you are developing a component for a bookshop:
jos_book (for the mainview/the books), jos_book_author, jos_book_publisher etc..
Jacc recognizes some fields which are standard for Joomla tables:
- title (varchar)
- name (varchar)
- alias (varchar)
- description (text)
- catid Category (int)
- category_id (int)
If you use this standards, Jacc roughly will create the right elements for the backend forms and lists.
A full list of special field names and the results is found on the tab Optimize your tables
Recommandation: Call your primary keys id
Jacc will recognize foreign keys in your tables, if you respect the naming
Tables: jos_example, jos_example_some, jos_example_foo
Foreign Keys: some_id, foo_id, example_id
So, if you use some_id in jos_example, this will create a select in the backend for the "Example" Detail View
One of the improvements of Joomla 1.6 >= is the forms library.
The forms are defined by an xml-file in models/forms. Have a look to joomla/form/fields in your component directory to get an idea of available field types. For more information visit docs.joomla.org/Developers
If you set the option Use Categories you will add Joomla categories to your component.
A frontend view will just print out the contents of the table fields. You can imagine, that there is no way for Jacc to guess right the purpose of your component.
There will be no SQL-joins in the frontend models for categories or foreign keys. Do it by yourself.
Jacc won't work, if you use a table prefix ends not with underscore
For developing with Jacc the following approach is suggested:
- Install Jacc on a Joomla that you use for development of components.
- Create a data model and implement as MySQL tables.
- Then import the tables into the Joomla on which you installed Jacc.
- Create the component and install it on the same Joomla.
- Define Maximum for Joomlas error reporting and then test, whether storing of items works in the backend.
- If this is not the case, check the naming of your table fields (common errors are a forgotten autoincrement or a lack of a primary id).
- Once your table structure is satisfying, you can generate and install the component again (a previous uninstallation is not necessary)
- In the Jacc Component Editor activate "live component" to create installation packages from the installed component. (Note that files already existing in the component are not overwritten, changes to the tables themselves will therefore have no effect.).
Now you can develope the component "on site" and use Jacc to create installation archives.