|Learning Joomla! 1.5 Extension Development|
|reviewer||Michael J. Ross|
|summary||An introductory guide to creating Joomla extensions.|
As with most if not all similar Joomla books, Learning Joomla! 1.5 Extension Development assumes that the reader has a solid understanding of PHP and MySQL, as well as some familiarity with administering a Joomla site. Absolutely no prior knowledge of Joomla extension development is required, and as a consequence this book can be a guide for any PHP programmer who knows how to install and administer Joomla, and wishes to take it to the next level through the development of custom Joomla extensions.
In the book's first chapter, LeBlanc explains the purpose of extending Joomla, and the advantages of this approach over hacking the Joomla core code in order to customize a site's functionality — a principle that should be known by any developer familiar with CMSs. He briefly discusses how Joomla extensions fall into five categories: components, modules, plug-ins, templates, and languages. The chapter continues with brief descriptions of what the subsequent chapters will cover — much of which is redundant, since that is already covered in the preface. This unsubstantial chapter next presents a brief mention of the example project to be created throughout the book (a restaurant reviews site), but offers no project requirements, constraints, or design parameters. Also noted are the requisite technologies one will need for creating the project on one's own: a Web server, PHP, MySQL, and Joomla 1.5. This chapter, like all others, ends with a chapter summary.
With Chapter 2, the author and the reader get into the actual technical content of the book — and not a moment too soon, having at this point passed more than five percent of the pages that follow the table of contents. This chapter's material should be especially welcome to any reader completely unfamiliar with Joomla components, because it explains how they are structured, how to execute them, the separation of front-end and back-end (administrator) directories, and how to register a component in the database (thereby enabling navigation to that component's page). Code and examples are provided that show how to create primary and secondary toolbars for the example project, as well as the native toolbar buttons. On page 17, the use of '_JEXEC' to prevent direct access to a Joomla PHP file, is explained three times; once would be enough. In fact, most if not all times that this (recommendable) technique appears in code in later chapters, its purpose is explained all over again.
One of the essential chapters for getting started on the example project, is the third, which discusses back-end development for the project, beginning first with the database table and its corresponding JTable class, for holding the restaurant reviews information. The discussion of best practices for a table prefix is a good idea, but many readers would most likely have appreciated some illustrative use of the inherited JTable methods. Next, the author briefly describes how the model-view-controller (MVC) design pattern can be used to simplify the code that will be written for the example project, and then explains the basic ideas of MVC, even more briefly. Naturally, the order of these two discussions should have been reversed. The chapter concludes with coverage of the Joomla code for creating the project's forms, as well as processing and managing the data.
With the fourth chapter, LeBlanc temporarily switches to front-end development, and demonstrates the Joomla code that allows visitors to the example project site to see a list of restaurant reviews, view the details of each, read comments posted by other visitors, and post their own comments. In addition, the use of search-engine-friendly (SEF) links is explored, including how to create and parse the needed HTTP request variables' parts.
In the subsequent chapter, the author steps the reader through the process of implementing profiles of restaurant critics in the example project — and in turn illustrates how to override JTable methods, sort records comprising database query results, track how many times particular records are viewed, implement record check-out and check-in functionality (for collaborative editing), store user information, generate page elements using the JHTML class, and enable user ordering of displayed records by using the JPagination class.
In Chapter 9, the focus shifts back toward more conventional Joomla extension topics — specifically, plug-ins. The author shows how to register new plug-ins in a Joomla database, how to create them, and what events can be registered (as functions in your plug-in), such as a user logging in or content being output. This knowledge is applied to creating plug-ins for the example project in order to support advanced searching of content, and for content authors to be able to have an example site automatically generate an information box when it detects specially tagged text in the content, before outputting it.
PHP programmers new to creating their own Joomla extensions, oftentimes struggle with figuring out how best to specify configuration settings so they are not buried in the code itself nor need to be added manually through MySQL queries — and, in turn, how to make it as easy as possible for those settings to be specified by any developer or site administrator who is using the custom extension. Chapter 10 shows how to do just that, with the information divided among the three types of Joomla extensions that most commonly need this flexibility: modules, plug-ins, and components.
Chapter 11 is somewhat like a catch-all repository for some miscellaneous topics: Leveraging Joomla's native article e-mailing functionality, Joomla extensions can be further enhanced by allowing the user to e-mail component content to other people. Joomla has built-in internationalization, allowing you to supplement any installable language packs with phrases for your custom extension's front-end and back-end user interface text — for any of the languages you choose to support. LeBlanc shows how to do that, for his example project. He also shows how to safely allow users to upload files to your Joomla server.
The final chapter of the book demonstrates how to package up all of the code and other files that you have created, so anyone else who wants to leverage that functionality can install your extension in their own Joomla-based Web site.
The book has a number of small blemishes, including several errata, e.g., "can [be] defined" (page 20), "set these variables to whatever value[s]" (page 31), "it the function proceeds" (page 74), "!." (page 76), "existing/modules" (page 112), and "contain[s] newlines" (page 238). There is the occasional erroneous capitalization of words (witness the first sentence in the "About the Reviewer" section), incorrect use of hyphens for creating adjectives, and inconsistent spelling of words (such as "back-end" and "backend"). All of these should have been caught by the publisher's line editors.
In some passages there is a dearth of commas that would help the reader know when to pause. The code formatting, such as indentation and brace placement, is not always consistent (e.g., pages 81 and 116). The chapter subheads should be in title case, but are instead in sentence case. Some of the HTML example code suffers from "div-itis," such as the use of div tags instead of label tags where appropriate (e.g., page 66). The Joomla root URL on the reader's local Web server — assumed by the author in all of the subsequent project URLs throughout the book — should have been mentioned in the first chapter, when discussing the prerequisite technologies for creating the example project, because that is the point in the book at which the reader would most likely have installed Joomla on their server.
All of the chapter summaries simply add bulk but no value to the book, and should be chopped, because the chapters are short enough to not justify any summarization. Moreover, in at least one instance (Chapter 10), the summary contains higher-level perspective not presented in the chapter itself, where it would be far more timely to the reader. In addition, the book provides apparently no figure numbers or captions, which arguably saves space, since readers rarely refer to them if they are reading the text closely, though less so when skimming through a technical book. Compared to its predecessor, this edition would still benefit from a lay-flat binding, and it still has the pointless header and footer lines, as well as page number bracketing (which admittedly seems to be part of the publisher's branding).
None of the aforesaid problems are of any gravity. The main problem with the book is that far too many of the discussions are rather cursory and fast-paced, lacking in both clear explanations of critical concepts and also an empathy for readers struggling to understand those concepts. For instance, the marketing copy for the book claims that the reader will learn the Model-View-Controller design pattern, when in fact the book fails to teach it well — instead only offering two foodservice examples, which are inadequate, particularly for any reader unfamiliar with design patterns in general. In other words, there is adequate explanation as to the specific steps for creating the example project code and other needed elements, but there is not enough explanation as to how those steps fit into the bigger picture, and how they could be enlarged so that the budding Joomla developer could create his or her own extensions, quite different from the book's example project.
On balance, Learning Joomla! 1.5 Extension Development is an approachable and useful resource for any developer who wants to maximize the functionality of their own Joomla-based Web sites — and perhaps share that new functionality with other developers by contributing the resultant extensions to the Joomla community.
Michael J. Ross is a freelance Web developer and writer.
You can purchase Learning Joomla! 1.5 Extension Development from amazon.com. Slashdot welcomes readers' book reviews — to see your own review here, read the book review guidelines, then visit the submission page.