What this book will do for you...

  • Make your extensions extensible, add extension points to allow third parties to customize your extensions
  • Create international extensions by enabling multilingual capabilities
  • Build more than just HTML pages - create PDF documents, JSON-RPC responses, and more!
  • Create Atom and RSS feeds to keep users up-to-date
  • Utilize the power of Subversion to maintain your source code
  • Execute database queries and handle returned data in order to access and modify your data
  • Keep your gremlins at bay by handling errors the Joomla! way

Joomla! 1.5 Development Cookbook

Get solutions to common Joomla! 1.5 Development problems, to make your extension development better, faster and more secure.

The author's experience with Joomla! 1.5 development enables him to share his insights effectively, in a clear and friendly way, giving practical hands-on solutions to problems, questions, and common tasks encountered in the design and implementation of Joomla! 1.5 extensions.

Chapters in this book

Chapter 1, Development using JoomlaCode.org and SVN, explores how to set up and use project hosting at JoomlaCode.org and explains how to use a JoomlaCode.org Subversion repository. more...

This chapter contains the following recipes:

  • Setting up a JoomlaCode.org project
  • Managing members of a JoomlaCode.org project
  • Setting up JoomlaCode.org Subversion
  • Understanding the Subversion skeleton
  • Understanding revisions in Subversion
  • Understanding the Subversion process
  • Checking out a Subversion repository using TortoiseSVN
  • Editing a working copy using TortoiseSVN
  • Inspecting changes using TortoiseSVN
  • Updating a working copy and resolving confl icts using TortoiseSVN
  • Committing changes using TortoiseSVN
  • Exporting a working copy using TortoiseSVN

Chapter 2, Keeping Extensions Secure, demonstrates how we can secure extensions and explains some of the ramifcations if we fail to do this. more...

This chapter contains the following recipes:

  • Writing SQL safe queries
  • Writing SQL safe LIKE string comparison queries
  • Using the token
  • Making a filename safe
  • Making a directory path safe
  • Making a path safe
  • Safely retrieving request data
  • Getting a value from an array

Chapter 3, Working with the Database, teaches us how to interact with the Joomla! database using the handy JDatabase interface. more...

This chapter contains the following recipes:

  • Executing a query
  • Loading the first cell from the result of a query
  • Loading the first record from a query
  • Loading more than one record from a query
  • Handling DBO errors
  • Creating a JTable
  • Creating a new record using a JTable
  • Updating a record using a JTable
  • Reading an existing record using a JTable
  • Deleting a record using a JTable
  • Checking a record in and out (record locking) using a JTable
  • Modifying record ordering using a JTable
  • Publishing and unpublishing a record using a JTable
  • Incrementing a record hit counter using a JTable

Chapter 4, The Session and the User, shows how we can interact with the current user, logged in or not, and how we can interact with their session. more...

This chapter contains the following recipes:

  • Getting the session handler
  • Adding data to the session
  • Getting session data
  • Checking for session data
  • Checking the session token
  • Getting the user
  • Determining if the current user is a guest
  • Getting the user's name and username
  • Getting the user's group ID and type
  • Restricting a user's access using Public, Registered, and Special
  • Getting the user's parameters
  • Setting the user's parameters
  • Extending and editing user parameters
  • Sending an email to the user

Chapter 5, Multilingual Recipes, discusses how to overcome common problems with making international extensions, such as how to deal with UTF-8.Preface more...

This chapter contains the following recipes:

  • Creating a translation
  • Translating some text
  • Determining the character length of a UTF-8 string
  • Removing leading and trailing UTF-8 whitespace
  • Comparing UTF-8 strings
  • Finding a UTF-8 string in a UTF-8 string
  • Executing a regular expression on a UTF-8 string
  • Reversing a UTF-8 string
  • Extracting a substring from a UTF-8 string
  • Replacing occurrences of a UTF-8 string in a UTF-8 string
  • Accessing characters in a UTF-8 string by position
  • Converting a string from one encoding to another
  • Creating a UTF-8 aware database installation script

Chapter 6, Interaction and Styling, describes how to restyle pages using CSS and JavaScript, and how to improve the user experience by adding Ajax capabilities. more...

This chapter contains the following recipes:

  • Getting page and component parameters
  • Adding CSS to a page
  • Overriding component templates
  • Adding JavaScript to a page
  • Creating a modal window
  • Generating modal content
  • Updating an element using Ajax and MooTools
  • Updating an element based on a form using Ajax and MooTools
  • Providing an Ajax response from a component
  • Enabling pagination in a list of items

Chapter 7, Customizing the Document, shows how we can modify the server response by working with the global document object. more...

This chapter contains the following recipes:

  • Setting the document title
  • Setting the document generator
  • Setting the document description
  • Adding metadata to the document
  • Changing the document character set
  • Changing the document MIME type
  • Controlling client caching of responses
  • Creating a PDF in a component
  • Creating an RSS or an Atom feed in a component
  • Outputting a RAW document from a component
  • Using a custom JDocument in a component (PHP 5 only)

Chapter 8, Customizing the Backend, looks at how to tailor the backend for our extensions, for example how to add buttons to the toolbar. more...

This chapter contains the following recipes:

  • Disabling the menu bar
  • Setting the toolbar title and icon
  • Adding common item manipulation buttons to the toolbar
  • Adding common itemized manipulation buttons to the toolbar
  • Adding custom buttons to the toolbar
  • Adding spacers and dividers to the toolbar
  • Adding a help system to a component
  • Creating a filter header for tabular data in an MVC component
  • Filtering tabular data in an MVC component
  • Creating toggle-enabled order column headers for tabular data in an MVC component
  • Ordering tabular data in an MVC component

Chapter 9, Keeping it Extensible and Modular, focuses on modularity and extensibility, showing how we can create versatile solutions that can be further extended by third parties. more...

This chapter contains the following recipes:

  • Loading plugins
  • Invoking a plugin
  • Creating a Joomla! search plugin
  • Creating your own library and import function
  • Installing a plugin programmatically during a component installation
  • Managing categories the easy way
  • Defining JParameters using XML
  • Creating a JParameter object
  • Rendering a JParameter object
  • Saving JParameter data
  • Getting and setting values in a JParameter object
  • Defining your own JParameter type

Chapter 10, JObjects and Arrays, looks at common things we can do with JObjects and arrays using Joomla!. more...

This chapter contains the following recipes:

  • Getting a JObject property
  • Getting all of the public JObject properties
  • Setting a JObject property
  • Setting a batch of the JObject properties
  • Reporting an error in a JObject
  • Getting an error from a JObject
  • Getting all errors from a JObject
  • Converting an object to an array
  • Converting an array to an object
  • Getting a column from a multidimensional array
  • Getting a value from an array
  • Casting all elements of an array to integers
  • Sorting an array of objects
  • Imploding an array

Chapter 11, Error Handling and Reporting, will help us discover how to deal with errors and, for PHP 5 extensions, exceptions. more...

This chapter contains the following recipes:

  • Raising an error-level J!error
  • Raising a warning-level J!error
  • Raising a notice-level J!error
  • Enqueuing a message
  • Changing the default J!error handling
  • Handling and raising a bespoke J!error
  • Logging errors and events using JLog
  • Throwing exceptions with PHP 5
  • Catching exceptions with PHP 5

Chapter 12, Files and Folders, deals with the flesystem and how we can interact with the flesystem using the Joomla! framework. more...

This chapter contains the following recipes:

  • Checking whether a file or folder exists
  • Reading a file
  • Deleting a file or folder
  • Copying a file or folder
  • Moving and renaming files and folders
  • Creating a folder
  • Uploading files to Joomla!
  • Reading a directory structure
  • Changing file and folder permissions

Author

James Kennard is an accomplished programmer with proven experience in many different types of organizations. He has worked as a private consultant, and has worked in the public and private sectors for the likes of Logica and the National Library of Wales. He has over six years experience working with Joomla!, previously Mambo. As an active member of the Joomla! community, he maintains a popular open source helpdesk component and wrote the popular book Mastering Joomla! 1.5 extension and framework development, also available from Packt Publishing.

Reviewers

Kevin Devine has been developing web sites using Joomla! since 2006 when he accepted a full-time position with PICnet. Based in Washington, D.C, PICnet is a web development company serving non-proft organizations across the United States. He also devotes time to the Joomla! project as a member of the Bug Squad, a co-maintainer of the 1.5.x release, and a member of the Joomla! Security Strike Team.

Rob Clayburn, along with running his company, Pollen 8 Design Ltd, is heavily involved as a project leader in Fabrik, an open source Joomla application builder, which allows users to rapidly prototype and create web applications.
As an avid and experienced web developer, Rob strives in all his projects to balance sound programming practices, intuitive UI design, and eye-catching graphics.
During his career, he has developed various web, mobile, and kiosk applications for clients ranging from a 3D kiosk game for The London Planetarium to various web applications, including a portfolio creator site and a geo-spatial social network.

Buy Now
Digg Twitter Stumble Upon Google Delicious Technocrati Technocrati Technocrati