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 with Joomla! 2.5 and Joomla! 3.x support
but this is not a good news..
Joomla extensions' team has eliminated the "Tools" category and they will no longer allow listings of tools like this, so, 'Joomla Component Builder' is no more a priority: all plans for J3.5 are delayed.
I work on it only when I can, so may be there will be holes between releases
"piutost che niènt, l'è mei piutost"
After the joomla's team decision, we released, in Jan 2014, an alpha version; a lot of improvements has been made since first release, but may be that not all works fine with code.
We released this alphas 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.
- 100% Free, no hidden fee, no subscription needed
- generates full working components
- retrieves the necessary data directly from a MySQL database
- works with unlimited tables or views
- Create controllers, models, forms, rules, views, tables and templates for any of the selected table
- 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 for 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.7.4+ from http://dev.mysql.com/downloads/connector/net/. please note: latest connector doesn't register themself into 'Reference Assemblies' so I put 'MySql.Data.dll' in in to the package. may be you don't need to install the connector: try without install first.
- a mysql db access via TCP / IP installed the tables containing the data for the management of which is to create the component
- knowledge of PHP programming and management of MySQL server. This is a tool for developer, NOT A TOY!
Scaffolding the MVC CRUD
Please, read carefully the instructions and the articles about the sample component (Create components for Joomla! - The example 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 marcoComponentMaker.exe.config to meet your MySQL server settings and add the connectionStrings
Using version 2.5+ you can also edit setting for mysql server connection using the program data grid for database selection; this is the simpliest way to edit these settings.
<?xml version = "1.0" encoding = "utf-8"?>
<add name = "testserver" ProviderName = "MySql.Date.MySqlClient" connectionString ="Server=192.168.10.76;Database=vmtest1; uid=root;Pwd=;JoomlaDbPrefix=jos_"/>
you have to 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)
- prefix used by joomla to identify its tables (JoomlaDbPrefix)
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="188.8.131.52" newVersion="184.108.40.206"/>
insert the driver build version as newVersion pararameter.
At the time of writing, the latest version of the mysql connector is 6.8.3, so, if you have downloade this one, change previous line to:
<bindingRedirect oldVersion="220.127.116.11" newVersion="18.104.22.168"/>
3. 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_']. not used from 2.5.04
- 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. Note: code generated is J3 compatible: no need to select J3.0.
- Generate translation file: create a translation file for each selected language (you have to translate... of course)
4. Select the DB server
You can edit setting for mysql server from program data grid. Yuo can add, edit or remove servers. remember tha you also have to set a schema (ie a database). See step 2 for required informations.
5. Select the tables to use.
Select the database tables for which will be created the scaffold (or CRUD or BREAD or the f***ing bizword of the moment).
fill in the fields:
- Select: Select the tables that will be part of the component
- Table Name: (read only) the name of the table in the DB
- Single record object handler name: the name used to create the objects needed to interact with the single record (default; the name of the table withou prefix)
- Recordset object handler name: the name used to create the objects needed to interact with the table recordset (default; the name of the table withou prefix + 'list')
6. Select the fields to show and edit.
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: reserved for internal team
- Render As:use a specific input type for rendering (input, text area, rte, select, boolean radio, calendar).
- Required: field is mandatory in editing
- Validator: generate models/rules php file for validation. JS not yet supported
- Comment: (read only)
Joomla supports some useful fields, these fields are managed by the framework itself, and it's a good idea add them to every table:
ALTER TABLE #__mytable ADD COLUMN `published` tinyint(1) NOT NULL DEFAULT '1', ADD COLUMN `checked_out` INT(10) UNSIGNED NOT NULL DEFAULT '0', ADD COLUMN `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', ADD COLUMN `hits` INT(10) UNSIGNED NOT NULL DEFAULT '0', ADD COLUMN `ordering` INT(11) NOT NULL DEFAULT '0';
less useful fields (not managed):
ALTER TABLE #__mytable ADD COLUMN `asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to the #__assets table.', ADD COLUMN `access` INT(10) UNSIGNED NOT NULL DEFAULT '0', ADD COLUMN `language` CHAR(7) NOT NULL;
7. Set parameters.
Not yet implemented. Options (preferences) for component. Does'nt work: press 'Next Step'.
8. scaffold the component.
Create the component for Joomla! in a subdirectory in the folder where you ran the progam (com_ [Safe Name])
9. Editing the generated code.
At this point you will:
- designing the layout for views in the front end, see com_[SafeName]/site/views/[TableClass]/tmpl/default.php
- obviously add the logic of the component in the controller ;)
- see Create components for Joomla! - The example component for tips on final set up.
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 4.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="22.214.171.124" newVersion="126.96.36.199"/>
188.8.131.52 is the latest version at time of writing; it 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
- js validation code generation
- 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)
Nov, 12, 2014 - v 2.5.04 Alpha
- many template improvments
- (I have to complete features list)
Aug, 10, 2014 - v 2.5.03 Alpha
- basic back end for J3+ (now works out of the box on j2.5 & J3.x)
- many template improvments
- added default task for overriding
- added code example for multiple task
- added support for nullable fields
Apr, 4, 2014 - v 2.5.02 Alpha
- fixed editing when PK is not `id`
- great work on translations
- fixed menù translation
- implemented sys language
- better translation's keys generation, no more duplicated items
- used Joomla string for common operation
- fixed mysql 5.5 missing ';'
- template improvments
- fixed models/rules files generation
- added model/fields generation
- improved install file: now it supports 'per dir' file inclusion. it's easier to add file to project
Jan 9, 2014 - v 2.5.01 Alpha
- fixed controller name
- fixed pagination
- better translation handler
Jan 7, 2014 - v 2.5.00 Alpha
- Joomla! 2.5 support
- Joomla! 3.x support
Jan 13, 2011 - v 184.108.40.206
- 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 220.127.116.11
- 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 18.104.22.168
- 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
No more supported nor devoloped