How to write a component for Joomla!TM 1.5 with marco's! Component maker for Joomla!

Develop components with marco's Component maker is relatively easy because the program will build all the skeleton of the component in this way the components generator allows the programmer to focus only on business logic, or over which is his main task.

In order to explain how to act on a component generated by the components generator, we are writing this series of articles that explain how to create a simple component for managing content.

YES: I know Joomla! do it by himself...

But, really, do you need another 'Hello word'?

We will use  marco's! Component maker for Joomla!, for building a quick component using table already present in a database for Joomla! 1.5: jos_sections, jos_categories and jos_content

The presence in each table, of the three fields:

  • `Id` int (11) NOT NULL auto_increment
  • `Published` tinyint (1) NOT NULL default '1 '
  • `Ordering` int (11) NOT NULL default '100 '

are not required in version past 1.5.0, but indication of a numeric primary key is still mandatory.

 

Now create the component, according to the instructions, and using this data suggested...

1. set up & configuration files

Download and install mysql connector from http://dev.mysql.com/downloads/connector/. Set right version of connector in marcoComponentMaker.exe.config. At the time of writing, the latest version of the mysql connector is 6.3.5

<bindingRedirect oldVersion="6.2.3.0" newVersion="6.3.5.0"/>

Add/modify connections string for data base access in <connectionStrings> section.

 

2. run the component creator for joomla!

First step/page: keep default values and press 'Next Step'

 

3. select db & tables

  1. select your db from drop down select and press 'Select Server'
  2. check these tables:
    • jos_sections
    • jos_categories
    • jos_content
  3. press 'Next Step'

 

4. configure fields

4.1 jos_sections

Select the jos_sections tab and edit the following fields:

  • title: set the 'Get Field Data' check box
  • description: select 'RTE' from 'Render As' drop down

 

4.2 jos_categories

Select the jos_categories tab and edit the following fields:

  • title: set the 'Get Field Data' check box
  • description: select 'RTE' from 'Render As' drop down

 

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!

 

4.3 jos_content

Select the jos_content tab and edit the following fields:

  • introtext: select 'RTE' from 'Render As' drop down
  • fulltext: select 'RTE' from 'Render As' drop down
  • sectionid: select 'Select List' from 'Render As' drop down
  • catid: select 'Select List' from 'Render As' drop down
  • access: select 'Select List' from 'Render As' drop down

Press 'Next Step' twice and 'End Work'. The component in now ready to install (it is in com_mcm sub folder): install it!

Now you are ready to follow instructions for use profitably marco's Component maker in your work.

Manage the back end article

Manage the front end article

 

Commenti  

 
-1 #5 Hassan 2011-10-30 13:26
Hi,

I am trying to make this working since past few hours. I have downloaded and tried different mysql drivers. But i am unable to make it work. I am using Xampp version 1.6.8 and mysql-connector-net-6.2.5.msi at the moment. And here is my marcoComponentM aker.exe.config

====Answer

hi Hassan,
if you want to submit code you should use the email at the end of the download page. for security reasons html/js/xml code is stripped out from comments.

anyway I suppose you forgot to update the bindingRedirect directive (see download page).

bye,
marco
Citazione
 
 
0 #4 Sloan 2011-10-20 05:15
Never mind. I read the info in the file that was of the download -- it had the right download link for the MySQL connector

Sorry 'bout that!! >> blush
Citazione
 
 
0 #3 Sloan 2011-10-19 22:02
Hi,

I'm having a bit of trouble connecting to the DB. I can get to it using phpAdmin, but when I start MCM, and on the 2nd form, I select the DB and click on the Select Server button, I get an error message:

System.IO.FileNotFoundExc eption: Could not load file or assembly 'MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44 d' or one of its dependencies. The system cannot find the file specified.
File name: 'MySql.Data, Version=6.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44 d'
at JoomlaComponent Builder.joomlaComponent Bui
....

I went to the link to get the MySQL connector, and downloaded the ODBC one. The PHP native didn't seem approriate.
Should I change the MySQL.data to something else like MySQL.odbc or similar?
I'm running XAMPP under window 7.

Thanks!
Citazione
 
 
+2 #2 Ospite 2010-04-11 19:56
Are known limitations, but I found acceptable for early versions of the program. in the future ...
Citazione
 
 
+1 #1 Ospite 2010-04-10 14:05
The program is nice, but it fails with tables which primary key is not the default 'id', for example, 'id_brand'.

Moreover, the columns publish and order are somehow not really usefull in all components.
Citazione
 

Aggiungi commento


Codice di sicurezza
Aggiorna