You are previewing Joomla! 1.5 Development Cookbook.
O'Reilly logo
Joomla! 1.5 Development Cookbook

Book Description

Solve real world Joomla! 1.5 development problems with over 130 simple but incredibly useful recipes

  • Simple but incredibly useful solutions to real world Joomla! 1.5 development problems

  • Rapidly extend the Joomla! core functionality to create new and exciting extension

  • Hands-on solutions that takes a practical approach to recipes - providing code samples that can easily be extracted

In Detail

Joomla! is the world's hottest open-source content management system. Out of the box, Joomla! does a great job of managing the content needed to make your website sing. Many Joomla! developers face common implementation hurdles, some might want to rapidly extend the Joomla! core functionality or might want to create new and exciting extensions.

This book has a "wealth" of solutions for problems that Joomla! developers face regularly. It provides step-by-step mini examples which show how to overcome common design and implementation problems when creating Joomla! extensions. It will help you setup a sustainable collaborative development environment using the powerful free services offered by JoomlaCode.org.

This book can be used in different ways. It can be used by the pro Joomla! developer looking for a specific solution to a problem and can also be used by a novice developer looking for an insight into an area of common problems, such as effectively handling errors in Joomla! Readers who choose to read an entire chapter will first be given a brief overview of the topic in hand and its role and importance when developing for Joomla! The Recipes contained within the chapter will introduce the reader to specific problems and provide hands-on solutions. It provides solutions for core design topics including security, data access, users, sessions, and multilingual capabilities.

Table of Contents

  1. Joomla! 1.5 Development Cookbook
    1. Joomla! 1.5 Development Cookbook
    2. Credits
    3. About the Author
    4. About the Reviewers
    5. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code for the book
        2. Errata
        3. Piracy
        4. Questions
    6. 1. Development using JoomlaCode.org and SVN
      1. Introduction
      2. Setting up a JoomlaCode.org project
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      3. Managing members of a JoomlaCode.org project
        1. Ho w to do it...
        2. How it works...
        3. There's more...
      4. Setting up JoomlaCode.org Subversion
        1. How to do it...
        2. How it works...
        3. See also
      5. Understanding the Subversion skeleton
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Understanding revisions in Subversion
        1. How to do it...
        2. There's more...
        3. See also
      7. Understanding the Subversion process
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Checking out a Subversion repository using TortoiseSVN
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      9. Editing a working copy using TortoiseSVN
        1. Getting ready
        2. Ho w to do it...
        3. See also
      10. Inspecting changes using TortoiseSVN
        1. How to do it...
        2. See also
      11. Updating a working copy and resolving conflicts using TortoiseSVN
        1. How to do it...
        2. How it works...
        3. See also
      12. Committing changes using TortoiseSVN
        1. How to do it...
        2. There's more...
        3. See also
      13. Exporting a working copy using TortoiseSVN
        1. How to d o it...
    7. 2. Keeping Extensions Secure
      1. Introduction
      2. Writing SQL safe queries
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
            1. NULL
            2. Hexadecimal
            3. Boolean
            4. Bit field
      3. Writing SQL-safe LIKE string comparison queries
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Using the token
        1. Getting ready
        2. How to do it...
        3. There's more...
      5. Making a filename safe
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Making a directory path safe
        1. How to do it...
        2. How it works...
        3. See also
      7. Making a path safe
        1. Getting ready
        2. How to do it...
        3. See also
      8. Safely retrieving request data
        1. Getting ready
        2. How to do it...
        3. There's more...
          1. Casting
          2. Masking strings
      9. Getting a value from an array
        1. How to do it...
    8. 3. Working with the Database
      1. Introduction
      2. Executing a query
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      3. Loading the first cell from the result of a query
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Loading the first record from a query
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      5. Loading more than one record from a query
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      6. Handling DBO errors
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Creating a JTable
        1. G etting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Creating a new record using a JTable
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Updating a record using a JTable
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Reading an existing record using a JTable
        1. Getting ready
        2. How to do it...
      11. Deleting a record using a JTable
        1. Getting ready
        2. How to do it...
      12. Checking a record in and out (record locking) using a JTable
        1. Getting ready
        2. How to do it...
        3. There's more...
      13. Modifying record ordering using a JTable
        1. Getting ready
        2. How to do it...
      14. Publishing and unpublishing a record using a JTable
        1. Getting ready
        2. How to do it...
      15. Incrementing a record hit counter using a JTable
        1. Getting ready
        2. How to do it...
    9. 4. The Session and the User
      1. Introduction
      2. Getting the session handler
        1. How to do it...
        2. How it works...
        3. See also
      3. Adding data to the session
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Getting session data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Checking for session data
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Checking the session token
        1. How to do it...
      7. Getting the user
        1. How to do it...
        2. There's more...
        3. See also
      8. Determining if the current user is a guest
        1. Getting ready
        2. How to do it...
        3. How it works...
      9. Getting the user's name and username
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Getting the user's group ID and type
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      11. Restricting a user's access using Public, Registered, and Special
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      12. Getting the user's parameters
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      13. Setting the user's parameters
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      14. Extending and editing user parameters
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Set rather than bind
          2. Forget about XML
        5. See also
      15. Sending an email to the user
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    10. 5. Multilingual Recipes
      1. Introduction
      2. Creating a translation
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. SVN
          2. What to translate?
        5. See also
      3. Translating some text
        1. How to do it...
        2. How it works...
        3. There's more...
          1. JavaScript safe
          2. Sprintf and printf
        4. See also
      4. Determining the character length of a UTF-8 string
        1. How to do it...
        2. How it works...
      5. Removing leading and trailing UTF-8 whitespace
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Comparing UTF-8 strings
        1. How to do it...
        2. How it works...
        3. See also
      7. Finding a UTF-8 string in a UTF-8 string
        1. How to do it...
        2. See also
      8. Executing a regular expression on a UTF-8 string
        1. How to do it...
        2. How it works...
        3. See also
      9. Reversing a UTF-8 string
        1. How to do it...
        2. How it works...
        3. See also
      10. Extracting a substring from a UTF-8 string
        1. How to do it...
        2. How it works...
        3. See also
      11. Replacing occurrences of a UTF-8 string in a UTF-8 string
        1. How to do it...
        2. How it works...
        3. See also
      12. Accessing characters in a UTF-8 string by position
        1. How to do it...
        2. There's more...
      13. Converting a string from one encoding to another
        1. How to do it...
        2. How it works...
      14. Creating a UTF-8 aware database installation script
        1. Getting ready
        2. How to do it...
        3. How it works...
    11. 6. Interaction and Styling
      1. Introduction
      2. Getting page and component parameters
        1. How to do it...
        2. How it works...
        3. See also
      3. Adding CSS to a page
        1. Getting ready
        2. How to do it...
        3. There's more...
          1. A sneaky shortcut
      4. Overriding component templates
        1. How to do it...
        2. How it works…
        3. There's more...
      5. Adding JavaScript to a page
        1. Getting ready
        2. How to do it...
        3. There's more...
          1. Big scripts
        4. See also
      6. Creating a modal window
        1. How to do it...
        2. How it works...
        3. There's more...
          1. Overriding options on a per-window basis
        4. See also
      7. Generating modal content
        1. How to do it...
        2. How it works...
        3. See also
      8. Updating an element using Ajax and MooTools
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      9. Updating an element based on a form using Ajax and MooTools
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      10. Providing an Ajax response from a component
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Enabling pagination in a list of items
        1. How to do it...
        2. How it works...
        3. There's more...
    12. 7. Customizing the Document
      1. Introduction
      2. Setting the document title
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      3. Setting the document generator
        1. Getting ready
        2. How to do it...
        3. See also
      4. Setting the document description
        1. Getting ready
        2. How to do it...
        3. See also
      5. Adding metadata to the document
        1. Getting ready
        2. How to do it...
        3. See also
      6. Changing the document character set
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      7. Changing the document MIME type
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      8. Controlling client caching of responses
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Creating a PDF in a component
        1. Getting ready
        2. How to do it...
        3. See also
      10. Creating an RSS or Atom feed in a component
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      11. Outputting a RAW document from a component
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Using a custom JDocument in a component (PHP 5 only)
        1. How to do it...
        2. How it works...
        3. T here's more...
        4. See also
    13. 8. Customizing the Backend
      1. Introduction
      2. Disabling the menu bar
        1. How to do it...
        2. How it works...
        3. See also
      3. Setting the toolbar title and icon
        1. How to do it...
        2. How it works...
        3. See also
      4. Adding common item manipulation buttons to the toolbar
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Adding common itemized manipulation buttons to the toolbar
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Adding custom buttons to the toolbar
        1. Getting ready
        2. How to do it...
        3. There's more...
        4. See also
      7. Adding spacers and dividers to the toolbar
        1. How to do it...
        2. See also
      8. Adding a help system to a component
        1. How to do it...
        2. How it works...
      9. Creating a filter header for tabular data in an MVC component
        1. How to do it...
        2. How it works...
        3. See also
      10. Filtering tabular data in an MVC component
        1. How to do it...
        2. How it works...
        3. See also
      11. Creating toggle-enabled order column headers for tabular data in an MVC component
        1. How to do it...
        2. See also
      12. Ordering tabular data in an MVC component
        1. Getting ready
        2. How to do it...
        3. See also
    14. 9. Keeping it Extensible and Modular
      1. Introduction
      2. Loading plugins
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      3. Invoking a plugin
        1. Getting ready
        2. How to do it...
        3. How it works
        4. See also
      4. Creating a Joomla! search plugin
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      5. Creating your own library and import function
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      6. Installing a plugin programmatically during a component installation
        1. Getting ready
        2. How to do it...
        3. How it works
        4. See also
      7. Managing categories the easy way
        1. How to do it...
        2. How it works
      8. Defining JParameters using XML
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      9. Creating a JParameter object
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      10. Rendering a JParameter object
        1. Getting ready
        2. How to do it...
        3. How it works
        4. There's more...
        5. See also
      11. Saving JParameter data
        1. How to do it...
        2. There's more...
        3. See also
      12. Getting and setting values in a JParameter object
        1. How to do it...
        2. How it works
        3. See also
      13. Defining your own JParameter type
        1. Getting ready
        2. How to do it...
        3. How it works
        4. See also
    15. 10. JObjects and Arrays
      1. Introduction
      2. Getting a JObject property
        1. How to do it...
        2. There's more...
        3. See also
      3. Getting all of the public JObject properties
        1. How to do it...
        2. How it works
        3. See also
      4. Setting a JObject property
        1. How to do it...
        2. There's more...
        3. See also
      5. Setting a batch of JObject properties
        1. How to do it...
        2. See also
      6. Reporting an error in a JObject
        1. How to do it...
        2. There's more...
        3. See also
      7. Getting an error from a JObject
        1. How to do it...
        2. There's more...
        3. See also
      8. Getting all errors from a JObject
        1. How to do it...
        2. See also
      9. Converting an object to an array
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      10. Converting an array to an object
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      11. Getting a column from a multidimensional array
        1. How to do it...
        2. See also
      12. Getting a value from an array
        1. How to do it...
        2. See also
      13. Casting all elements of an array to integers
        1. How to do it...
        2. See also
      14. Sorting an array of objects
        1. How to do it...
        2. How it works
        3. There's more...
      15. Imploding an array
        1. How to do it...
        2. There's more...
    16. 11. Error Handling and Reporting
      1. Introduction
      2. Raising an error-level J!error
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      3. Raising a warning-level J!error
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      4. Raising a notice-level J!error
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      5. Enqueuing a message
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      6. Changing the default J!error handling
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      7. Handling and raising a bespoke J!error
        1. How to do it...
        2. How it works
        3. See also
      8. Logging errors and events using JLog
        1. Getting ready
        2. How to do it...
        3. How it works
        4. There's more...
      9. Throwing exceptions with PHP 5
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      10. Catching exceptions with PHP 5
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
    17. 12. Files and Folders
      1. Introduction
      2. Checking whether a file or folder exists
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      3. Reading a file
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Deleting a file or folder
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Copying a file or folder
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Moving and renaming files and folders
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Creating a folder
        1. How to do it...
        2. How it works
        3. There's more...
        4. See also
      8. Uploading files to Joomla!
        1. Getting ready
        2. How to do it...
        3. How it works
        4. There's more...
          1. Avoid dangerous file types
        5. See also
      9. Reading a directory structure
        1. How to do it...
        2. How it works
        3. There's more
      10. Changing file and folder permissions
        1. Getting ready
        2. How to do it...
        3. How it works