This book is intended for use as a reference book for existing Joomla! developers. It focuses on the Joomla! framework and how to utilize it to enhance and standardize extensions.
Joomla! is a modular and extensible PHP MySQL CMS (Content Management System). Joomla! is an open-source project, which is released under version 2 of the GPL license. Joomla! has fast become one of the most popular open-source CMS, as is proved by its numerous awards and massive online community.
One of the things that has made Joomla! so popular is the large number of freely and commercially available extensions, which enable users to do far more than simply manage content. This list details some common functions that extensions perform:
Banner Ads & Affiliates
Calendars
Communication (Chat Rooms, Forums, Guest Books, Mailing Lists, Newsletters)
Content & News (Blogs, eCards, News)
Documentation (Downloads, FAQs, Wikis)
eCommerce (Auctions, Shopping Carts)
Forms
Gallery & Multimedia
Intranet & Groupware
Search & Indexing
Joomla! is a modular and extensible PHP MySQL CMS (Content Management System). Joomla! is an open-source project, which is released under version 2 of the GPL license. Joomla! has fast become one of the most popular open-source CMS, as is proved by its numerous awards and massive online community.
One of the things that has made Joomla! so popular is the large number of freely and commercially available extensions, which enable users to do far more than simply manage content. This list details some common functions that extensions perform:
Banner Ads & Affiliates
Calendars
Communication (Chat Rooms, Forums, Guest Books, Mailing Lists, Newsletters)
Content & News (Blogs, eCards, News)
Documentation (Downloads, FAQs, Wikis)
eCommerce (Auctions, Shopping Carts)
Forms
Gallery & Multimedia
Intranet & Groupware
Search & Indexing
Rice Studios, formerly Miro, created a closed-source CMS called ‘Mambo’ in the year 2000. One year later, Mambo was re-licensed under two separate licenses, one of which was open source. The open-source version became known as ‘Mambo Site Server’.
In 2002 Mambo Site Server was re-branded ‘Mambo Open Source’ (Also referred to as MamboOS or MOS) in an attempt to differentiate the commercial and open-source flavors of Mambo. All rights to Mambo Open Source were officially released into the open-source community in 2003.
Mambo Open Source was extremely successful and won a large number of prestigious open-source awards.
In 2005 the commercial version of Mambo was re-branded as ‘Jango’. Rice Studios, at that time still Miro, also chose to form the Mambo Foundation, a non-profit organization. The intention was to create a body that would help protect the principles of Mambo and provide a more structured working methodology.
The creation of the Mambo Foundation created a rift in the Mambo Open Source community. The creation of the Mambo Foundation was seen by many as an attempt by Rice Studios to gain control of the Mambo Open Source project.
Not long after the Mambo Foundation was created, a group, consisting mainly of the Mambo Open Source core developers, publicly announced that they intended to abandon Mambo Open Source. The group formed a non-profit organization called ‘Open Source Matters’.
Open Source Matters created the Joomla! project, a guaranteed 100% open-source GPL project. The first release of Joomla! (Joomla! 1.0) was very similar to the then current release of Mambo, the majority of extensions at the time being compatible with both.
Restraints within Joomla! 1.0 led to a complete re-think of how Joomla! should be constructed. After a long development period, and two beta releases, Joomla! 1.5 was released in mid 2007.
Joomla! 1.5 is extensively different to Joomla! 1.0 and Mambo. Joomla! 1.5 introduces many new classes and implements a comprehensive framework. These changes have lead to reduced compatibility between Joomla! and Mambo.
The most notable change, for most third-party extension developers, is the introduction of the MVC (Model View Controller) design pattern in components. These changes now mean that all third-party developers tend to develop for Joomla! or Mambo, but not both.
To use Joomla! and develop new extensions there are a number of basic requirements. This list details the minimum requirements:
MySQL 3.23 available at http://www.mysql.com
PHP 4.3 available at http://www.php.net
A web server (if using Apache, minimum version is 1.13.19, which is available at http://www.apache.org)
Note
Precise version requirements may differ depending upon the exact version of Joomla! that is being used.
An easy way to quickly obtain and install all of these is to use XAMPP (X, Apache, MySQL, PHP, and Perl). This project packages all of the necessary pieces of software required to run Joomla! in one installation package. XAMPP is available for the Linux, Mac, Solaris, and Windows operating systems. To learn more about XAMPP please refer to http://www.apachefriends.org/xampp.html.
Another easy way to get started with Joomla! is to use JSAS (Joomla! Stand Alone Server). JSAS enables us to quickly set up multiple Joomla! installations on a Windows-based system. To learn more about JSAS please refer to http://jsas.joomlasolutions.com.
Joomla! itself is relatively easy to set up and, if necessary, an administration and installation guide can be found on the official Joomla! help site: http://help.joomla.org.
A Joomla! extension is anything that extends Joomla!’s functionality beyond the core. There are three main types of extension: components, modules, and plugins.
There are also languages and templates, but these are solely designed to modify page output, irrespective of the data being displayed. Although we will discuss the use of translation files and templates, we will not explicitly cover these two extension types in this book.
Tools, sometimes referred to as extensions, are essentially any type of extension that does not fall into the extension type categories just described. We will not be discussing how to create tools in this book.
Extensions are distributed in archive files, which include an XML manifest file that describes the extension. It is from the manifest file that Joomla! is able to determine what type the extension is, what it is called, what files are included, and what installation procedures are required.
Components are undoubtedly the most fundamental Joomla! extensions. Whenever Joomla! is invoked a component is always called upon. Unlike other extensions, output created by a component is displayed in the main content area. Since components are the most fundamental extension, they are also generally the most complex.
One component of which all Joomla! administrators will be aware, is the content component. This component is used to display articles, content categories, and content sections.
In addition to outputting component data as part of an XHTML page, we can output component data as Feeds, PDF, and RAW documents.
Many components tend to include, and sometimes require, additional extensions in order for them to behave as expected. When we create our own components it is generally good practice to add ‘hooks’ in our code, which will enable other extensions to easily enhance our component beyond its base functionality.
Modules are used to display small pieces of content, usually to the left, right, top or bottom of a rendered page. There are a number of core modules with which we will be instantly familiar, for example the menu modules.
There are various types of plugin, each of which can be used differently; however, most plugins are event driven. Plugins can attach listener functions and classes to specific events that Joomla! can throw using the global event dispatcher.
This table describes the different core plugin types:
Plugin Type |
Description |
---|---|
authentication |
Authenticate users during the login process |
content |
Process content items before they are displayed |
editors |
WYSIWYG editors that can be used to edit content |
editors-xtd |
Editor extensions (normally additional editor buttons) |
search |
Search data when using the search component |
system |
System event listeners |
user |
Process a user when actions are performed |
xmlrpc |
Create XML-RPC responses |
In addition to the core plugin types we can define our own types. Many components use their own plugins for dealing with their own events.
Joomla! has multilingual support, which enables us to present Joomla! in many different languages. Language extensions include files that define translated strings for different parts of Joomla!.
We will discuss how to create language files and how to use translations in Chapter 2 and Chapter 9.
We use templates to modify the general appearance of Joomla!. There are two types of template extension: site templates and admin templates.
Most Joomla! sites use bespoke site templates to modify the appearance of the frontend (what the end-user sees). Admin templates modify the appearance of the backend (what the administrators see); these templates are less common.
There are many websites that offer free and commercial Joomla! templates, all of which are easy to locate using a search engine.
Tools, although referred to as extensions, are very different to components, modules, and plugins. The term ‘tools’ is used to describe any other type extension that can be used in conjunction with Joomla!.
Tools are not installed to Joomla!; they are generally standalone scripts or applications, which may, or may not, require their own form of installation.
A good example of a Joomla! tool is JSAS (Joomla! Stand Alone Server). JSAS provides an easy way to set up Joomla! installations on a Windows-based system. To learn more about JSAS please refer to http://jsas.joomlasolutions.com.
Joomla! uses the extension manager to manage extensions that are currently installed and to install new extensions. When we install new extensions we use the same installation mechanism irrespective of the extension type. Joomla! automatically identifies the type of extension during the extension installation phase.
JED (Joomla! Extension Directory) is an official part of Joomla! and is maintained by the ‘Sites and Infrastructure’ working group. The directory categorizes details of third-party Joomla! extensions on which users are allowed to post reviews and ratings.
Details of extensions that are listed in JED are submitted and maintained by the extension owner or developer. A listed extension can include a category, name, description, homepage, image, license, version, download link, demonstration link, developers name, email address, and Joomla! version compatibility information.
JED is the normal place where administrators look for extensions for their Joomla! installation. Before we create new extensions it is good practice to investigate any similar existing extensions; JED is the perfect place to begin. If we intend to make an extension publicly available JED is one of the best places to advertise an extension.
Another invaluable resource is the developers’ forge: http://www.joomlacode.org. This official site is used to host open-source Joomla! projects. It provides third-party open-source Joomla! developers with free access to useful project development tools. This list details some of the tools with which JoomlaCode.org provides us:
Document Manager
Forums
FRS (File Release System)
Mail Lists
News
SVN (Subversion)
Tasks
Tracker
Wiki
If we intend to create an open-source Joomla! project, it is advisable to consider using JoomlaCode.org to host the project, even if we do not intend to use all of the features it provides.
There are numerous development tools available, which we can use to develop Joomla! extensions. Most of these tools are not specific to Joomla!, but are PHP tools.
When we come to choose an editor for modifying PHP source files, it is important that we ensure that the editor supports UTF-8 character encoding.
There are two development tools built especially for Joomla!. They are J!Code and J!Dump.
A recent addition to the Joomla! developers toolkit is J!Code. Based on EasyEclipse and PHPEclipse, J!Code is an IDE (Integrated Development Environment) designed specifically for developing Joomla! extensions.
J!Code is currently in the early stages of development and has yet to release a stable version.
J!Dump allows us to output variables during development. The output is displayed in a configurable pop-up window and describes data types, and object properties and methods.
J!Dump comes as two separate extensions: a component, which we use to configure the functionality of J!Dump, and a system plugin, which defines functions that we use to ‘dump’ data to the J!Dump popup. Both extensions are required in order for J!Dump to function correctly.
Note
To use J!Dump the plugin must be published. If it is not, when we attempt to use the J!Dump functions we will encounter fatal errors.
The most important function in J!Dump is the dump()
function. We can pass a variable to this function and it will be displayed in the popup. This example demonstrates how we use the dump()
function:
// create example object $object = new JObject(); $object->set('name', 'example'); // dump object to popup dump($object, 'Example Object');
Using this will create a popup, which looks like this:
Other functions we can use include dumpMessage()
, dumpSysinfo()
, dumpTemplate()
, and dumpTrace()
.
One of the most pleasurable things about working with Joomla! is the encouragement of openness and friendliness amongst the members of the Joomla! community. It is, without a doubt, the community that is driving the Joomla! project. The name ‘Joomla!’ is derived from the Swahili word ‘Jumla’, meaning ‘all together’. The Joomla! community lend a true sense of jumla to the project.
In this chapter we have seen that there are essentially six types of extension: components, modules, plugins, languages, templates, and tools. As we have seen, each type has a very specific use. We have lightly discussed the way in which extensions of different types can be dependant upon one another.
Whilst we did not dwell on development tools, we have investigated the two most prominent tools, J!Code and J!Dump. Even experienced PHP developers should investigate other/new development tools.