Thank you for your contribution:
If not, they have to hire someone to write a component for their special needs or do it by themselves.
In this chapter we want to build a component for a real estate agency. It should contain house listings and detailed descriptions of the houses on the frontpage and a possibility to manage these listing in the backend. We have to think about the fields, the permissions, the image upload and many other requirements, too.
A typical Joomla! component like the web links component consists of 30+ files for the frontend and 30+ files for the backend. Every page in a Joomla! website contains the output of exactly one component.
Joomla! is build on the model-view-controller architecture (MVC) which was first described for user interfaces of a programming language called Smalltalk in 1979.
Today MVC is the de facto standard in software development.
It comes in different flavours, control flow is generally as follows:
- The user interacts with the user interface in some way (for example, by clicking a submit button).
- The controller handles the event from the user interface, and converts it into an appropriate user action, understandable for the model.
- The controller notifies the model of the user action, possibly resulting in a change in the model's state. (For example, the controller updates the user's house listing.)
- A view queries the model in order to generate an appropriate user interface (for example, the view lists the house listings). The view gets its own data from the model.
- The user interface waits for further user interactions, which restarts the control flow cycle.
Joomla! MVC Implementation
In Joomla!, the MVC pattern is implemented using three classes: JModel, JView and JController.
Is It Necessary to Build A Component From Scratch?
A few years ago, building a component from scratch was the only way to enhance Joomla! core. Today we have several content construction kit components (CCK) available. After installing one of these CCK components, you are able to configure additional content types with additional fields. The configuration is mostly easy but you depend on an additional Joomla! component that is the base of your use case.
I am user and I want a simple directory for my website.
Don't waste time with developing component, download a CCK and configure what you need.
I am a company with a use case that will not change in the next five years and I found not the right component in the JED. The company has no IT department with developers.
Try to solve your problem with a CCK. If it doesn't work, start with your own component.
I am a company with a use case that will not change in the next five years and I didn't find the right component in the JED. The company has an IT department with developers.
Let the IT department come together and discuss it. Try out CCK's and individual component development.
I am a developer and I want to create components. I want to sell them online.
Well, you have to learn it :)
How to Start?
I did a little research using Google, Joomla.org and the usual suspects. I found two very detailed tutorials on How to write an MVC component. The first one is from Christophe Demko, France and the second one is from Rune V. Sjøen, Norway. There are more tutorials available.
Another interesting approach for component development is to create a whole component automatically, based on your desires.
- A project on GitHub called jFoobar started by Amy Stephen:
JFoobar Component Builder builds a fully functioning Joomla Component, complete with ACL, Views, Models, and Controllers for the Administrator and Site. You can customize your Component for your site building needs by defining new data and customizing the Layouts.
- A company called Not Web Design™ offers a component creator as a paid service that will create all the necessary files based on your desired configuration. By using the paid pro version, you can create your own list and form views with custom fields, potentially saving you several days of work.
Try to build your own component from scratch to get an idea and afterwards try out both builders to check whether they are useful for you.
The Cocoate Real Estate Component
Based on the tutorials mentioned above I will build a Real Estate component in I am not sure right now how many steps.
We need more or less three types of applications in one component.
The site application, also called frontend, is the area of your site that guests and users see. It is used for displaying content. The components of the site application live in the /components folder in your Joomla! root.
The administrator application, also called backend, is the administration area of your site. Where logged in managers and administrators can manage the site. The components of the administrator application lives in the /administrator/components folder in your Joomla! root
- Installation and Update
To install an update for your component, we need xml files for configuration and meta data, sql files with database queries and later on an update server to provide new versions of the component.