Book Image

Learning Joomla! 3 Extension Development - Third Edition

By : Timothy John Plummer
Book Image

Learning Joomla! 3 Extension Development - Third Edition

By: Timothy John Plummer

Overview of this book

Joomla 3 is the first of the major open source content management systems that was meant to be mobile friendly by default. Joomla uses object-oriented principles, is database agnostic, and has the best mix of functionality, extensibility, and user friendliness. Add to that the fact that Joomla is completely community driven, and you have a winning combination that is available to everyone, and is the perfect platform to build your own custom applications. "Learning Joomla! 3 Extension Development" is an integrated series of practical, hands-on tutorials that guide you through building and extending Joomla plugins, modules, and components. With Joomla having been downloaded well over 35 million times, there is a huge market for Joomla extensions, so you could potentially earn some extra cash in your spare time using your newly acquired Joomla extension development skills. We will start with developing simple plugins and modules, and then progress to more complex backend and frontend component development. Then we will try our hand at ethical hacking, so you will learn about common security vulnerabilities and what you can do to avoid them. After that we will look at how you can prepare your extensions for distribution and updates, as well as how you can extend your components with various plugins and modules. Finally, you will end up with a fully functioning package of extensions that you can use on your own site or share with others. If you want to build your own custom applications in Joomla, then "Learning Joomla! 3 Extension Development" will teach you everything you need to know in a practical, hands-on manner.
Table of Contents (18 chapters)
Learning Joomla! 3 Extension Development
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
Index

Tools you need to develop the Joomla! extensions


Obviously you need a computer to develop Joomla! extensions, but the type of computer you choose is completely up to you. There are free open source software for all the major operating systems, but the most popular operating system in the Joomla! community from my observations at Joomla!Day events seems to be Mac, although personally I use Windows, and there are those that use Linux too. When it comes to Joomla! development, there is no advantage of one operating system over another; you should choose whatever you are most comfortable and familiar with.

You will need to set up a local development environment with a web server, PHP and MySQL, however there are many ways of achieving this. XAMPP is quite popular, and it will work on Windows, Mac, and Linux. There are also a lot of alternatives such as MAMP , WAMP , EasyPHP , and Webmatrix , just to name a few. For Joomla! 3, you should make sure that whichever you choose has PHP Version 5.3.1 or greater, and has MySQL Version 5.1 or greater. Apache webserver is most commonly included in these tools, but there is nothing stopping you from using an alternative webserver such as IIS. You could even set up PHP and MySQL manually if you prefer. You could have no local development environment and just work off a live webserver, but I would not recommend this as it's going to be much faster and more convenient for you to have the local environment, and there is no risk of breaking anything on a live site. Most of these software packages such as XAMPP also include a tool to manage your MySQL database called phpMyAdmin .

To test your code, you will need a web browser, and once again you have many to choose from. I personally like Firefox , but many people develop using Chrome , IE or Safari . I really like the Firebug plugin for Firefox which allows you to inspect elements to see what CSS code is being applied, which is really handy for development purposes. All the major browsers now have some kind of similar development tools, so what you choose to use is entirely up to you. Another great feature of Firefox is the error console, which will help you pinpoint JavaScript errors. You can see the Firebug plugin in the bottom-half part of the following screenshot:

When developing Joomla! extensions, you will need a text editor or an Integrated Development Environment (IDE) to edit the source code. If you are just starting out, try a simple text editor such as Notepad++ or Textedit . The main requirements are that the text editor should support the UTF-8 format and should display line numbers. If you plan to do a lot of development, then an IDE is definitely worth learning. The most popular in the Joomla! community are Eclipse and NetBeans . An IDE has some powerful features that make your life easier and can integrate with Subversion or Git to manage version control. They can also allow you to use a builder such as Phing or Ant to automatically create installable packages for your extensions and simultaneously copy the code to multiple development sites, and they can do file comparisons to see what has changed. Another big advantage of an IDE is that you are able to use a debugging tool such as XDebug to set up breakpoints to step through, and inspect code while it is running. I personally use Eclipse, which can be slow when used on older computers, but if you have a fast processor such as an i7, it works great.

The following screenshot demonstrates how to set Notepad++ preferences to use UTF-8 encoding:

The following screenshot shows where you can turn on line numbers in Notepad++.