Creating components for Joomla! 2.5 and Joomla! 3.5 is a very time consuming activity because you have to write an high number of file to manage every single piece of information, not only at DB table level, but also at DB field level.
However much of this code is just a mechanical writing... So why rewrite it every time?
This is why I wrote Marco's Component Maker for Joomla! 2.5 and Joomla! 3.5 (formerly Joomla Component Builder), for me it was useful, I hope it is for you.
Building components for Joomla!2.5 & Joomla!3.5
New version 2.5.01: Joomla! 2.5 and Joomla! 3.x support
but this is not a good news..
Joomla extensions' team have eliminated the "Tools" category and they will no longer allow listings of tools like this.
So, most likely, this will be the latest release of 'Joomla Component Builder', all plans for J3.5 are suspended.
Please note also that instructions in this page could be out-dated and there is no more support; refer to the comments at the end of the page for a little help.
"piutost che niènt, l'è mei piutost"
After the joomla's team decision, we released a very alpha version, so don't belive all works fine with code.
We released this alpha only for give a little help with repetitive actions to developers, because, how we said in the heading "rather than nothing, it is better rather" (idiomatic phrase in the old slang of Milan).
Scaffolding the CRUD
The "database first" approach
This is the way I'm used to walk when I'm programming. First I design the database structure, with entities and relationships, then I write the code to manage the data.
This program reads the database structure, lets you to select tables and fields and it writes the scaffolding structure for the CRUD, so you have (almost) only to implement the business logic code.
You can create the CRUD for a lot of tables in a few minutes. Of course this program is not perfect, but it will speed up your work considerably.
- generates full working components
- retrieves the necessary data directly from a MySQL database
- Create controllers, models, views, tables and templates for any of the selected tables
- auto determins primary key field (must be numeric)
- creates the files needed to edit individual records and to display the listing of tables
- generates installable components
- is based on customizable templates to generate the php files of Joomla
- templates are based on the component com_hello so you can refer to the documentation of Joomla!
- Joomla 2.5 and 3.x native code generation but still alpha
- runtime NET 4.0+
- MySql Connector-Net 6.4.4+ from http://dev.mysql.com/downloads/connector/net/
- a mysql db access via TCP / IP installed the tables containing the data for the management of which is to create the component
- a little 'patience as it is still in beta ...
- knowledge of PHP programming and management of MySQL server. This is a tool for developer, NOT A TOY!
As you understood, this is a machine translation. Not always I have time to translate the text, so I limit myself to some corrections: sorry...
Creating the MVC CRUD
Please, read carefully the instructions
and the articles about the sample component before asking for help. The program is provided free, but without any support. anyway I try to respond to every mail.
please, READ THIS FOXED PAGE till the end. thanks.
download the package: Joomla! generator components (downloads are at the end of the page, before comments) and unzip it in a folder.
change JoomlaComponentBuilder.exe.config (marcoComponentMaker.exe.config since v 1.1) to meet your MySQL server settings and add the connectionStrings
<?xml version = "1.0" encoding = "utf-8"?>
<add name = "testserver" ProviderName = "MySql.Date.MySqlClient "connectionString =" Server = 192.168.10.76; vmtest1 Database = uid = root; =;"/> Pwd
you would enter:
- mnemonic IP address or server (Server)
- database name to use (Database)
- username (UID) [must be able to see the tables needed to component]
- Password (PWD)
Note on MySQL Connector 6.2.2:
This version of the connector has a bug: the insertion of a key without the corresponding value generates a runtime error, so if you wish to access the DB without a password, and you omit the value for password, you have not to insert the Pwd keyword.
the connection string, instead of:
<add name="testServer" providerName="MySql.Data.MySqlClient" connectionString="Server=192.168.10.76;Database=vmtest1;Uid=root;Pwd=;"/>
<add name="testServer" providerName="MySql.Data.MySqlClient" connectionString="Server=192.168.10.76;Database=vmtest1;Uid=root;/>
(ip and databases values are just examples)
Newer MySQL Connector driver:
To use a new MySQL driver with this build of the program open marcoComponentMaker.exe.config and locate the line
<bindingRedirect oldVersion="220.127.116.11" newVersion="18.104.22.168"/>
insert the driver build version as newVersion pararameter.
At the time of writing, the latest version of the mysql connector is 6.3.5, so, if you have downloade this one, change previous line to:
<bindingRedirect oldVersion="22.214.171.124" newVersion="126.96.36.199"/>
run the program.
fill in the fields:
- Component Name: the name of the component
- Safe Name: the name (without _ or other strange characters, using only lowercase letters) for use in models. ... Controllers
- Table prefix: used to install Joomla (Prefix Table) [part of the name to be replaced with'#__', typical 'jos_']
- License: license for generated files (do do)
- Render "text" fields as: default renderer for text type(tinytext, text, mediumtext, longtext) fields
- textarea: default html <textarea>
- rte editor: Joomla! rte editor
- Render "datetime" fields as: default renderer for datetime type(date, time, timestamp, datetime) fields
- calender: Joomla! js calendar
- string: default html <input>
- Output Version: targeted Joomla! version
- Generate translation file: create a translation file for each selected language (you have to translate... of course)
and then select the database tables for which will be created models, controllers and views
fill in the fields:
- Select: Select the tables that will be part of the component
- FE: not yet implemented
- FE view: not yet implemented
- Table Class: The name used to create the table
- Single record object handler name:The name used to create the objects needed to interact with the table recordset
- Recordset object handler name: The name used to create the objects needed to interact with the single record
the program parses the DB and shows the fields in every table
use tab navigation to select the table to edit. These options works only on BE (back end)
- Field name: (read only)
- Field type: (read only)
- Show in list:show field when list records (default: primary key, `id`, `name`, `title`, `publish`, `published`, `ordering`, `access`)
- Search:use field for search records in table (default: all text type fields)
- Show in edit:show field in edit form (default: all but primary key)
- Get Field Data:generate method in record list model to get specific field values (see code comments for help)
- Foreign key:not implemented yet
- Render As:use a specific input type for rendering (input, text area, rte, select, boolean radio, calendar)
- Comment: (read only)
Please pay attention!
'Get Field Data' doesn't check if method name is valid. so if you select the field 'name' will be generated the getName() method overriding the JModel->getName(). In doubt add a suffix to auto-generated method! (fixed in 188.8.131.52)
Not yet implemented. Options (preferences) for component. Does'nt work: press 'Next Step'.
Create the component for Joomla! in a subdirectory in the folder where you ran the progam (com_ [Safe Name])
At this point you will:
- correct form of editing data in forms of back-end com_[SafeName]/admin/views/[TableClass]/tmpl/default.php
- designing the layout of views in the front end in com_[SafeName]/site/views/[TableClass]/tmpl/default.php
- obviously add the logic of the component in the controller;)
let me know what you think: be good, is still in beta;)
The program requires Microsoft. NET 4.0+. Version for Joomla! 2.5 and 3.x will be released only for the Windows environment (Windows: XP, Vista, Windows 7)
May be it can run on Linux or Mac under Mono, but it is not tested nor supported.
Important Note: For more details, or for troubleshooting installation issues, refer to the support of Microsoft, Mysql or Mono for your operating system.
Here I collected some error messages and the explanation of problem. Please do not ask help about MySql Server or .NET / Mono configuration.
Could not load file or assembly 'MySql.Data'
This error means that MySql connector was not properly installed: usually this is not a marcoComponentMaker issue.
- Be sure to have full .NET 2.0 (or greater) and MyQql connector installed; refer to Microsoft and/or MySql documentation/help.
If you installed the connector properly you should have it listed in Control Panel/Software; if it is not present try again to install it.
- Update the reference to library in marcoComponentMaker.exe.config config file
Should look like:
<bindingRedirect oldVersion="184.108.40.206" newVersion="220.127.116.11"/>
18.104.22.168 is the latest version at time of writing. MUST match the installed version of connector!
Unable to connect to any of the specified MySQL hosts
This errors occurs when Mysql server does not accept connections from remote/local clients.
- Ensure socket connections are enabled or bind-address is properly set in my.cnf; check also the port used for connection (usually 3306).
Configuration options may change: refer to MySql server documentation.
- Check (personal) firewalls.
- If you are trying to connect to a remote server, ask your provider if you can access the sql server from outside the network (and how). Usually this is not possible.
You can use MySql tool to check connections and analyze network problems.
Access denied for user 'aUser'@'aNetwork' (using password: [YES|NO])
Username and / or password are wrong or a grant is needed for user. Refer to MySql documentation.
planned for next versions (
some time in the future, ...but seriously)
- J2.5 per table ACL
- move every 'generated code' template in external resource
- full xml metadata for menu items
- full foreign keys support
- j2.5 per table-> row ACL (low priority)
Jan 9, 2013 - v 2.5.01 Alpha
- fixed controller name
- fixed pagination
- better translation handler
Jan 7, 2013 - v 2.5.00 Alpha
- Joomla! 2.5 support
- Joomla! 3.x support
Jan 13, 2011 - v 22.214.171.124
- Joomla! 1.6 support
- generation of multiple translation files
- no more use of global vars ($mainframe, $option) both J1.5 and J1.6 code
- minor code improvements
Dec 29, 2010 - v 126.96.36.199
- support for translation files
- more input render types (string, text area, rich text editor, calendar, select list, boolean radio button)
- field by field rendering control
- minimun support for related tables (foreign keys)
- selection of fields for list/editing
- selection of searchable fields
Jun 12, 2010 - v 188.8.131.52
- no more mandatory fields in table (id, ordering,published)
- automatic recognition of primary key (no need that there is `id`, but must be numeric)
- generation of submenu for navigation between controllers, no more need to add navigation manually
- back end table list with sortable fields list & filter
- automatic rendering based on DB field type (input/textarea/rte/calendar)
- input validation, based on DB field type, before saving data
- configuration file management for generated component
- more security checks
April 13, 2010
- maintenance release for mysql connector 6.2.3
April 5, 2010
- Added checks on the names of objects and on the structure of db
- Added checks for mandatory fields
- Improvements in PHP code
February 13, 2010
- no new release: but Linux and Mac OS X tested!
December 17, 2009
- See Italian Text (sorry...)
December 10, 2009
- be: moved textbox first order of sliders
- be: moved pages are included out of the loop
- BE: fixed bug which delete the fields and ordering published
- BE: added indentation in view template
- be: table, correct the comment with bars \ \
- BE: model, proper initialization of the new object by retrieving the values from table
- BE: view.html.php, proper inspection new item instead of $ hello $ data
- BE: model, input methods to sort the records
- BE: controllers, embedded controllers in the specification of all the entry point redirects
November 20, 2009
- initial release
- Poor front end generation
- 1.5.1+ tab control doen't work: USE only 'next step button'
- 1.5.1 "Get Field Data" in parse table doesn't check generated method name and can ovverride Joomla! methods.
No more supported nor devoloped