Difference between Joomla Module & Component
What is the difference between a Joomla! module and a Joomla! component?
When it comes to laying out content that you can manage yourself, the Joomla! article area provides a great deal of flexibility, however, it is not always flexible enough and to get the look you want, and you might need to use Joomla's modules or components. Joomla! modules and components allow updateable content to be styled and positioned on the page exactly the way you want.
Both modules and components provide a method for the site administrator to alter content on the site, but components provide a great deal more functionality than modules. Everything that can be achieved with can module can also be done with a component, and a lot more besides.
At the time a module is created, the number of areas of editable content are fixed. That is, the number of images or regions of text that a particular module can display cannot be altered at a later date without rebuilding the module. It is common to see modules used as side boxes on a website, where they display editable text and images that complement the main body of the page.
In contrast to modules, components are much more flexible, allowing entirely new pieces of content to be added without the need for the component to be rebuilt. A component provides an easy to use structure to add, edit and reorder items of content that all fit a particular format.
It is possible to create modules that can work with the data that is managed via a component. The component allows the site administrator to easily enter and manage new content and various modules can then be used to display this data in different ways on the site. In general, modules display content and provide only basic methods to update the content, component on the other hand provide advanced functionality to manipulate that data.
As an example, consider a page used to display a list of the team member of a company. Each team member would have an image, name, job description and contact details.
It is not possible to use a Joomla! article area to display this type of information in a structured format, so either a component or module would be needed.
Using a module to build this page would have the following major limitations:
- The maximum number of team member would have to be defined when the module was built. If for example the module was created to display ten team members, then whilst the details of each of these member could be easily edited, if the team grew to eleven member then the module would have to be recoded.
- To re-order the team members, you would have to manually delete and re-enter content in the right order. If the team member at the top of the list were to be removed, then the details of the second team member would have to be copied into the first position, the third into the second position and so on.
It would be possible mitigate these problem by introducing additional module parameters and cloning modules but this would be a much more cumbersome and less user-friendly solution than can be achieved using a component, which allow for:
- An unlimited number of team members could be easily added.
- The list of team members could be reordered by simply clicking up and down buttons.
- Clear instructions could be provided next to each input area of the admin page, providing help to anyone who wanted to update the page.
- At the click of a button, a team member on a prolonged leave of absence could be removed from the site and when they returned, their profile could be activated again just as easily.
- The ability to lay out the data in a more complicated way. For example, if you wanted each team member to link through to their own page, this would be possible to be done with a component, and the admin would still only have to go to one place in order to update everything about that team member, rather than having to update multiple areas.
Ultimately, components are considerably more user-friendly, but they require more work to create and are therefore more costly.
If, in the above example, team member needed to be added to the site on a weekly basis, then a component would be the best choice, to make the task as easy and error proof as possible. If, however, the team member page was only going to be updated once or twice a year, then the more cumbersome module method is likely to be the more cost effective.