Book Image

Learning Joomla! 1.5 Extension Development

Book Image

Learning Joomla! 1.5 Extension Development

Overview of this book

Table of Contents (17 chapters)
Learning Joomla! 1.5 Extension Development
Credits
About the Author
About the Reviewer
Preface

Preface

Although Joomla! has all of the basic content management tools you need to build a website, it is also designed to also run custom-built extensions written in PHP. This book steps through working examples of PHP code written to work seamlessly in Joomla!. Topics covered in this book include libraries for generating user interface elements, database table classes, Model-View-Controller design, configuration panels, the use of JavaScript libraries, and URL routing. After all of the code has been written, it is bundled in .zip files, ready to be installed by Joomla! site webmasters.

What this book covers

Chapter 1 gives you an overview of how Joomla! works. The example project used throughout the book is also introduced. The three types of extensions (components, modules, and plug-ins) are covered, along with a description of how they work together.

Chapter 2 begins with the development of the component used in the project. Initial entries are made in the database and toolbars are built for the backend. The general file structure of Joomla! is also introduced.

Chapter 3 walks through the creation of the backend interface for creating, editing, and deleting records in the project through the Model-View-Controller design pattern. Database table classes are also introduced.

Chapter 4 builds a frontend interface for listing and viewing records. Additionally, code to generate and interpret search engine friendly links is covered. The project is also expanded slightly, as a commenting feature is added.

Chapter 5 takes a closer look at the methods provided by the JTable, JHTML, and JUser classes. The JTable class allows you to manage a list of ordered records, while JHTML helps generate common HTML elements. Also, the concept of checking out records when JTable and JUser are used together is introduced.

Chapter 6 introduces a module used to list records on every page of the site. The module takes advantage of layouts, where the same data can be formatted differently depending on how the code is called. Some of the code is also separated out into a helper class so that the main code generating the module stays simple.

Chapter 7 continues development of the component, adding elements from the JTHML class that make the component blend in with the rest of the Joomla! interface. Controls over the publishing of records are introduced, as well as an interface for removing offensive comments. More toolbars are added, and multiple controllers are introduced.

Chapter 8 shows how to add many common JavaScript effects to your extensions. This chapter also explains how to create a Google Map and interact with it using MooTools. Finally, a way of using jQuery alongside MooTools is covered.

Chapter 9 develops three plug-ins. The first plug-in finds the names of records in the database and turns them in to links to those records. A second plug-in displays a short summary of the record when certain code is added to content articles. Finally, another plug-in is designed so that records are pulled up alongside Joomla! content searches.

Chapter 10 adds configuration parameters to the components, modules, and plug-ins. These are handled through XML and generate a predictable interface in the backend for setting options. Retrieving the value of these parameters is standardized through built-in functions.

Chapter 11 adds links and functionality to the component where users can email pages to their friends. It also prepares the user interface for internationalization and does a partial translation into French. Additionally, the chapter provides a solution for handling uploaded files.

Chapter 12 expands the XML files used for parameters and adds a listing of all the files and folders in each extension. Once this file is compressed along with the rest of the code into a ZIP archive, it is ready to be installed on another copy of Joomla! without any programmer intervention. Custom installation scripts and SQL code are also added to the component.

Who is this book for

This book is suitable for PHP programmers who want to take their first steps in customizing and extending the features of Joomla! through custom PHP development. It is not a reference guide for advanced Joomla! developers.

You only need to understand the basics of PHP programming; no experience of developing Joomla! extensions is assumed. You are expected to be familiar with the general operation of Joomla!.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "We do not need to specify the directory where the framework is located; jimport() takes care of this."

A block of code will be set as follows:

function edit()
{
JRequest::setVar('view', 'single');
$this->display();
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

switch($task)
{
case 'add':
addSingle();
break;
case 'save':
saveSingle();
break;
}

Any command-line input or output is written as follows:

UPDATE jos_critic SET ordering = id;

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "clicking the Next button moves you to the next screen".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to, and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code for the book

Visit http://www.packtpub.com/files/code/6200_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books maybe a mistake in text or code we would be grateful if you would report this to us. By doing so you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.