Extension types and their uses

There are many ways to extend the functionality of Joomla! using add-on software called extensions. Extensions can be installed on your Joomla! site and they add new functionality, in some cases they change the way your website behaves by overriding the core code.

The three main extension types we are going to cover in this book are plugins, modules, and components, and we will also create a package extension.

Plugins

Plugins are code that run in the background and are triggered by events. When you log onto your Joomla! website, an authentication plugin checks your login credentials and decides whether you should have access to the site or not. Plugins can be used to transform content, such as replacing a tag in an article with a Google map, or cloaking an email address and protecting it from spammers. Plugins can be very powerful, you can also use plugins to override core code and change how Joomla! works.

The following screenshots demonstrate how a plugin replaces an address in an article with an actual Google map.

As you can see, the address has been transformed into a Google map showing where the Sydney Opera House is located.

Modules

Modules are used to display content at a particular place on your website. Your site template defines various module positions that determine where these modules are displayed. The menu of your website is a module, and if you have a small login form, that would also be a module. You might even have a social media module to display your Facebook or Twitter news feed. There are both frontend and backend modules, and often modules work in conjunction with components to display information on your website. Some developers use modules as a workaround to bring library code in, for example, RocketTheme's RokNavMenu, but that is not really what they should be used for. The following screenshot is of a login module:

Components

Components are the apps of the Joomla! world and the most complex extension type. Components are displayed in the main content area of the site, which is often the largest area in the template. Most menu items load a page with a component and there is only one component displayed on the page at a time. Most components have database tables to store or retrieve information. Components generally have a frontend and a backend just like Joomla!, although there are some tools that focus on the backend with nothing displayed on the frontend of the site, for example, Akeeba Admin Tools. You can enhance components using modules and plugins; for instance, you may have a search plugin that allows you to search for the content stored in your component, or a module that displays the latest items for the component. The following screenshot shows one of the core components called com_content; you will see this screen when you are creating an article from the front end of your site:

Languages

Joomla! is used worldwide by many people whose first language is not English. Many websites need to be displayed in the local language of the audience and some even need to support multiple languages. A language pack includes the files necessary to translate the text used on the site. This translates predefined language strings used by core Joomla! or its extensions; it does not translate the article text, on the fly, into another language. We are not going to cover language packs in this book, but we will see how we can translate your extension into multiple languages. The following screenshot shows the control panel menu when the Dutch (NL) language is installed:

Templates

We don't want all our websites to look the same, so Joomla! has a powerful template engine that allows you to install additional templates to change the look and feel of the site. Since the content is separated from the presentation, it is easy to give your site a facelift by simply changing the template, assuming the new template has the same module position names. Every Joomla! website uses at least two templates, a site template for the frontend, and an admin template for the backend. It is also possible to have different pages on the same website using different templates. We are not going to cover templates in this book, as there are plenty of books already dedicated to this subject.

The following screenshot shows the default Joomla! 3 template protostar:

The next screenshot shows exactly the same content with a different template applied, in this case, Beez3, and you can see that this looks very different than the Protostar template.

Libraries

Reusable code libraries, which are a collection of classes, can now be installed in the libraries folder. This is a better way of creating reusable code than putting it in a plugin, as this way the code is only used when needed rather than running in the background waiting for an event trigger. Libraries extension type was introduced in Joomla! 1.6. We are not going to cover the library extension in this book.

Packages

Joomla! allows you to bundle related extensions together into a package, so that you can install multiple extensions in one go. It allows you to install your component and any associated plugins and modules all in one go, rather than the user having to install each one individually.