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

Upgrading a Joomla! 2.5 component to make it Joomla! 3 compatible


If anyone has told you that all you need to do to upgrade an extension from Joomla! 2.5 to Joomla! 3 is do a find-and-replace for the new legacy classes, then they were lying, or didn't know what they were talking about. This may be true for very simple extensions that are already following best practices, but in reality there is a lot more work involved. There were a number of functions that were deprecated or changed, and with the introduction of Bootstrap, the backend interface has undergone some significant changes. So to make the extension work well on Joomla! 3, there is a bit of work involved.

The following section details a lot of the changes you will need to make to get your extension working in Joomla! 3:

http://docs.joomla.org/Potential_backward_compatibility_issues_in_joomla_3.0_and_Joomla_Platform_12.1

Some of the changes are quite subtle, such as changing the nameQuote to QuoteName, but some require a bit more work than just finding and replacing, such as the changes from getTableFields to getTableColumns. One change I'd like to highlight is the removal of DS that was commonly used for the directory slashes in previous Joomla! versions. Now you should use / instead. For example, JPATH_COMPONENT.DS.'controller.php' would now be written as JPATH_COMPONENT.'/controller.php'. Although you could define a DS constant to avoid having to change your code, I would recommend that you make the effort and update your code.

For plugins and modules, this is probably all you need to do to them and they will work, but for components it is not quite that easy. Even after you've made all these changes, although your extension may work in Joomla! 3, it may not look very pretty. You will see an example of this in the following screenshot, where there are unnecessary bullet points and a field that is only partially showing:

Since Joomla! 3 now uses Bootstrap and is mobile-ready, there is a bit of work required to make the extension look and behave like the core extensions, as there are a number of visual changes such as the introduction of tabs. All the detailed changes necessary to convert a Joomla! 2.5 component to a fully Joomla! 3 native component are outside the scope of this book, but you will be able to compare your code to our Joomla! 3 examples to get an idea of what you need to change, or you could also have a look at com_weblinks. The following screenshot shows the same form as shown in the previous screenshot, however this one has been fully updated to support Joomla! 3: