PacktLib: Joomla! 1.5 Development Cookbook

Joomla! 1.5 Development Cookbook


About the Author

About the Reviewers


Development using and SVN


Setting up a project

Managing members of a project

Setting up 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 conflicts using TortoiseSVN

Committing changes using TortoiseSVN

Exporting a working copy using TortoiseSVN

Keeping Extensions Secure


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

Working with the Database


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

The Session and the User


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

Multilingual 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

Interaction and Styling


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

Customizing the Document


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 Atom feed in a component

Outputting a RAW document from a component

Using a custom JDocument in a component (PHP 5 only)

Customizing the Backend


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

Keeping it Extensible and Modular


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

JObjects and Arrays


Getting a JObject property

Getting all of the public JObject properties

Setting a JObject property

Setting a batch of 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

Error Handling and Reporting


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

Files and Folders


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