You are previewing Professional Joomla!.
O'Reilly logo
Professional Joomla!

Book Description

As a major force in the world of affordable, advanced web site deployment, Joomla! has become the most important noncommercial Content Management System (CMS) in the world. The number of Joomla! downloads and add-ons continues to grow at lightning pace, spurring the need for a resource that explores the diverse needs of professional Joomla! developers. This book fills that void by covering the two main areas of the Joomla! field--development and deployment--with a focus on the new Joomla! version 1.5 and all the features it provides.

Seasoned author Dan Rahmel walks you through the process of creating all three types of Joomla! extensions (modules, components, and plug-ins), explains how best to use Ajax technology, and shows you how to adopt design patterns and incorporate source code control. You'll examine the underlying technologies (PHP, Apache, etc.) that can be tuned to offer the best system performance, and you'll explore interfacing with outside content, Lightweight Directory Access Protocol (LDAP) setup, and much more. You'll even delve into the internal structure of the Joomla! framework, and obtain a unique behind-the-scenes education so that you can modify and extend Joomla! to meet the needs of you and your customers.

What you will learn from this book

  • How each server of a Joomla! system can be installed and configured for maximum performance

  • The process of creating a module from scratch

  • Ways to use Ajax to add dynamic data retrieval to Joomla!

  • Techniques for using design patterns to solve common programming problems

  • How to create and retain a virtual community

  • Procedures for tuning a Joomla! site for both Search Engine Optimization (SEO) and Search Engine Management (SEM)

Who this book is for

This book is for web developers, hobbyists, web designers, bloggers, corporate content creators, and support specialists who are looking to build a more robust web site. Basic skills in the area of PHP programming are necessary.

Wrox Professional guides are planned and written by working programmers to meet the real-world needs of programmers, developers, and IT professionals. Focused and relevant, they address the issues technology professionals face every day. They provide examples, practical solutions, and expert education in new technologies, all designed to help programmers do a better job.

Table of Contents

  1. Copyright
  2. Credits
  3. About the Author
  4. Acknowledgments
  5. Introduction
    1. Who This Book Is For
    2. What This Book Covers
    3. How This Book Is Structured
    4. What You Need to Use This Book
    5. Conventions
    6. Source Code
    7. Errata
    8. p2p.wrox.com
  6. 1. Introducing Joomla!
    1. 1.1. Getting to Know Joomla
    2. 1.2. Flexibility Makes Joomla the CMS of Choice
    3. 1.3. Who Needs This Book
      1. 1.3.1. Web Masters
      2. 1.3.2. Web Designers
      3. 1.3.3. Web Developers
    4. 1.4. Joomla Version 1.0 and Mambo Users
    5. 1.5. Summary
  7. 2. The Finer Points of Installation and Configuration
    1. 2.1. Four Servers in the Joomla System
      1. 2.1.1. Installation Choices
        1. 2.1.1.1. Local Installation or Remote Deployment
        2. 2.1.1.2. Choice of Platform: Windows, Linux, or MacOS
        3. 2.1.1.3. Installation of Individual Servers or Combined Installation
        4. 2.1.1.4. Choice of Web Server: Apache or Microsoft Internet Information Server (IIS)
      2. 2.1.2. Steps in the Joomla Installation Process
      3. 2.1.3. Configuring Apache Web Server
        1. 2.1.3.1. Configuration Files
          1. 2.1.3.1.1. DirectoryIndex Directive
          2. 2.1.3.1.2. LogLevel Directive
          3. 2.1.3.1.3. ServerRoot Directive
          4. 2.1.3.1.4. Other httpd.conf Directives
        2. 2.1.3.2. Log Files
        3. 2.1.3.3. Modules and Extensions Folders
        4. 2.1.3.4. htdocs Folder
      4. 2.1.4. Configuring PHP
        1. 2.1.4.1. PHP Directives
          1. 2.1.4.1.1. Modifying PHP Error Reporting
          2. 2.1.4.1.2. Important PHP Settings
      5. 2.1.5. Configuring MySQL
        1. 2.1.5.1. MySQL Setup
          1. 2.1.5.1.1. Activating the Path Parameter on Windows
          2. 2.1.5.1.2. Database Connectivity with MySQL 5
          3. 2.1.5.1.3. Strict Mode and Data Insert Problems
        2. 2.1.5.2. MySQL Administration
        3. 2.1.5.3. Resetting a MySQL User Password
      6. 2.1.6. Configuring Joomla
        1. 2.1.6.1. configuration.php
        2. 2.1.6.2. Resetting a Joomla User Password
    2. 2.2. Staging Servers and Deployment Servers
      1. 2.2.1. Staging Server Setup
      2. 2.2.2. Deployment Server Setup
        1. 2.2.2.1. Default Accounts and Passwords
    3. 2.3. Summary
  8. 3. Developing Custom Templates
    1. 3.1. Template Structure
      1. 3.1.1. Files and Folders
      2. 3.1.2. Template Logic: The Index File
      3. 3.1.3. Joomla Execution Statements
        1. 3.1.3.1.
          1. 3.1.3.1.1. Using JDocument Objects
          2. 3.1.3.1.2. Using the $this Object Variable
          3. 3.1.3.1.3. Accessing Template Parameters
          4. 3.1.3.1.4. A Primitive index.php
      4. 3.1.4. Template Presentation: The CSS File
        1. 3.1.4.1. In-line and Block Element Types
        2. 3.1.4.2. Default Styles
        3. 3.1.4.3. Incorporating Images in the CSS
      5. 3.1.5. Template Metadata: The TemplateDetails File
      6. 3.1.6. Template Variables: The Parameters File
      7. 3.1.7. Template Graphics: The Images Folder
      8. 3.1.8. Template Thumbnail
    2. 3.2. Creating a Three-Column Template
      1. 3.2.1. Create the Template Folder and Rough Details
      2. 3.2.2. Creating the index.php
        1. 3.2.2.1. Create Rounded Corners Stylesheet
        2. 3.2.2.2. Creating the Rounded Corner Graphics
        3. 3.2.2.3. Creating a Banner Graphic
        4. 3.2.2.4. Changing the Module
        5. 3.2.2.5. Custom CSS for Components
    3. 3.3. Creating the Details File for Distribution
    4. 3.4. Advanced Template Techniques
      1. 3.4.1. Using a Template Family with CSS
      2. 3.4.2. favicon.ico
      3. 3.4.3. Core Output Override Templates
      4. 3.4.4. Creating a Cell Phone-Centric CSS
        1. 3.4.4.1. Defining the Handheld CSS
      5. 3.4.5. Converting a Mambo or Joomla 1.0 Template
    5. 3.5. Summary
  9. 4. Adding and Modifying Available Extensions
    1. 4.1. Extensions Directory
    2. 4.2. Site Features and Management
      1. 4.2.1. Enabling a Different WYSIWYG Editor
      2. 4.2.2. Add a Custom Style to TinyMCE
      3. 4.2.3. Adding File Management and FTP Support
      4. 4.2.4. Adding a Sitemap
      5. 4.2.5. Community Builder
        1. 4.2.5.1. Structure of Community Builder
        2. 4.2.5.2. CB Plug-Ins
        3. 4.2.5.3. User Avatar
        4. 4.2.5.4. Download and Installation
    3. 4.3. Organizations and E-commerce
      1. 4.3.1. Subscription Manager
      2. 4.3.2. MicroShop PayPal Shopping Cart
      3. 4.3.3. Project Fork Project Manager
      4. 4.3.4. Timesheets Extension
      5. 4.3.5. Adding an Auction Framework to Your Site
    4. 4.4. Site Content
      1. 4.4.1. Podcasting through Joomla
      2. 4.4.2. Providing a Picture Gallery
    5. 4.5. Site Interactivity
      1. 4.5.1. Adding Comments for Posted Articles
      2. 4.5.2. Guestbook
      3. 4.5.3. Chat Rooms through Joomla
      4. 4.5.4. Setting Up a Wiki System in Joomla
      5. 4.5.5. eWriting
      6. 4.5.6. Implementing Classified Ads
      7. 4.5.7. Adding Sports Tracking
      8. 4.5.8. Adding Casino Games
      9. 4.5.9. Handling a Quiz
    6. 4.6. Summary
  10. 5. Developing Simple Extensions: Modules
    1. 5.1. Creating a Hello World Module
    2. 5.2. Creating a Holiday Greetings Module
      1. 5.2.1. Creating the XML Descriptor File
      2. 5.2.2. Creating the Module Code File
      3. 5.2.3. Creating the Table and Storing Sample Data
      4. 5.2.4. Configuring the Module
    3. 5.3. Creating a Contact Us Module
    4. 5.4. Summary
  11. 6. Advanced Extensions: Components
    1. 6.1. Setting Up a Development System
    2. 6.2. Adopting Source Code Control with SVN
      1. 6.2.1. Installing SVN
      2. 6.2.2. Creating a SVN Repository
      3. 6.2.3. Using Eclipse
        1. 6.2.3.1. Download EasyEclipse and Installation
        2. 6.2.3.2. Configuring Eclipse
        3. 6.2.3.3. Workbench Basics
    3. 6.3. Creating a Guestbook Component
      1. 6.3.1. Protecting against Guestbook Spamming
      2. 6.3.2. The Front-End Guestbook Component
        1. 6.3.2.1. Creating the Front-End Component
      3. 6.3.3. The Administrator Guestbook Editor Component
      4. 6.3.4. The XML Descriptor
      5. 6.3.5. Adding the Component to the SVN Repository
      6. 6.3.6. Archiving the Component
      7. 6.3.7. Installing the Guestbook Component
    4. 6.4. Using phpDocumentor
      1. 6.4.1. Installation
      2. 6.4.2. Adding DocBlocks to Source Code
    5. 6.5. Summary
  12. 7. Joomla! and Ajax
    1. 7.1. Structure of Ajax
    2. 7.2. Simple Ajax Component
      1. 7.2.1. Creating the Component
      2. 7.2.2. Creating the Ajax Web Page
    3. 7.3. Creating a Server-Query Component
      1. 7.3.1. Creating the Component
        1. 7.3.1.1. Accepting the Query Request
        2. 7.3.1.2. Querying the MySQL Database
        3. 7.3.1.3. Returning XML Output
      2. 7.3.2. Creating the Ajax Module
        1. 7.3.2.1. Creating the Module Folder and XML File
        2. 7.3.2.2. Creating mod_articleajax
        3. 7.3.2.3. Pop-Up Window
        4. 7.3.2.4. Requestor Functions
        5. 7.3.2.5. Finding Articles in the Joomla Database
    4. 7.4. Ajax Disadvantages
      1. 7.4.1. Ajax SEO Invisibility
      2. 7.4.2. Information Harvesting
      3. 7.4.3. Security Risks
    5. 7.5. Summary
  13. 8. Design Patterns and Joomla!
    1. 8.1. Design Patterns
    2. 8.2. Three Primary Categories of Patterns
      1. 8.2.1. Creational Patterns
        1. 8.2.1.1. Abstract Factory Pattern
        2. 8.2.1.2. Singleton Pattern
        3. 8.2.1.3. Builder Pattern
      2. 8.2.2. Structural Patterns
        1. 8.2.2.1. Adapter Pattern
        2. 8.2.2.2. Bridge Pattern
      3. 8.2.3. Behavioral Patterns
        1. 8.2.3.1. Observer Pattern
        2. 8.2.3.2. Chain-of-Responsibility Pattern
        3. 8.2.3.3. Strategy Pattern
      4. 8.2.4. Concurrency Patterns
      5. 8.2.5. Architectural Patterns
        1. 8.2.5.1. Server-Based Pattern
        2. 8.2.5.2. Client-Execution Pattern
    3. 8.3. Model-View-Controller Pattern
      1. 8.3.1. MVC for Joomla Components
        1. 8.3.1.1. The Model File: mvc.php
        2. 8.3.1.2. The View Files
        3. 8.3.1.3. The Controller File: controller.php
        4. 8.3.1.4. The Descriptor File: hellomvc.xml
    4. 8.4. Summary
  14. 9. Hooking into the Joomla! Foundation: Plug-Ins
    1. 9.1. Joomla Plug-In Overview
      1. 9.1.1. Content Events
      2. 9.1.2. Editor Events
      3. 9.1.3. System and Search Events
      4. 9.1.4. User Events
    2. 9.2. Hello World Plug-In
      1. 9.2.1. Create the XML Descriptor File
      2. 9.2.2. Create the plug-in Code
    3. 9.3. Text Abbreviation Replacement Plug-In
      1. 9.3.1. XML Descriptor Code
      2. 9.3.2. plug-in Code
    4. 9.4. Joomla Framework Access
      1. 9.4.1. Joomla CMS (JApplication) Structure
        1. 9.4.1.1. JInstallation Application
        2. 9.4.1.2. JSite Front-End Application
        3. 9.4.1.3. JAdministrator Back-End Application
      2. 9.4.2. Path Variables
      3. 9.4.3. Tips for Examining Joomla Source Code
      4. 9.4.4. Using a Directory Search Function
      5. 9.4.5. Examining com_content
      6. 9.4.6. Joomla SVN: The Bleeding Edge
    5. 9.5. Summary
  15. 10. Building Joomla! Communities
    1. 10.1. Planning a Virtual Community
      1. 10.1.1. Three Stages of a Virtual Community
        1. 10.1.1.1. Stage 1: Development and Testing
        2. 10.1.1.2. Stage 2: Launch and Gathering
        3. 10.1.1.3. Stage 3: Redefinition and Maturity
      2. 10.1.2. Understanding the Importance of Stability and Regularity
      3. 10.1.3. Why You Should Create a Virtual Community
    2. 10.2. Technology of a Virtual Community
      1. 10.2.1. Guestbook
        1. 10.2.1.1. Easybook
        2. 10.2.1.2. Jambook
      2. 10.2.2. Chat
        1. 10.2.2.1. BlastChat
        2. 10.2.2.2. utChat
      3. 10.2.3. Forums and Message Boards
        1. 10.2.3.1. Simple Machines Forum (SMF)
        2. 10.2.3.2. Fireboard
      4. 10.2.4. Polls
      5. 10.2.5. Comments
        1. 10.2.5.1. AkoComment Tweaked Special Edition 1.4.6
        2. 10.2.5.2. !JoomlaComment
      6. 10.2.6. Social Networking
        1. 10.2.6.1. SocialBookmarkerBot v1.3.2
      7. 10.2.7. Event Calendar
        1. 10.2.7.1. Events Calendar (JEvents) Extension
        2. 10.2.7.2. JCalPro
      8. 10.2.8. Wiki Systems
        1. 10.2.8.1. OpenWiki
        2. 10.2.8.2. WikiBot
    3. 10.3. Deploying a Virtual Community
      1. 10.3.1. Legal Liabilities
      2. 10.3.2. Grooming Moderators
    4. 10.4. Maintaining a Community
    5. 10.5. Summary
  16. 11. Managing a Professional Deployment
    1. 11.1. Development and Testing
      1. 11.1.1. Development and Testing
      2. 11.1.2. Debug Settings
      3. 11.1.3. PHP Command Line Interface (CLI)
      4. 11.1.4. Automated Testing
        1. 11.1.4.1. Page Validation
        2. 11.1.4.2. Unit Testing
    2. 11.2. Site Deployment
      1. 11.2.1. Transferring to the Deployment Server
      2. 11.2.2. Joomla Backup
      3. 11.2.3. Apache Virtual Hosts Configuration
      4. 11.2.4. Controlling Apache from the Command Line
      5. 11.2.5. Multi-Server Management
        1. 11.2.5.1. MySQL Instance Manager
        2. 11.2.5.2. PhpMyAdmin
      6. 11.2.6. Load Testing
      7. 11.2.7. Load Balancing
      8. 11.2.8. Internationalization
      9. 11.2.9. Automated Content Vetting
    3. 11.3. MySQL Performance Tuning
      1. 11.3.1. Setting the Data Drive
      2. 11.3.2. Selecting a Server Type
      3. 11.3.3. Source of Problems
      4. 11.3.4. Optimizing Indexes
        1. 11.3.4.1. Use of Compound Indexes
        2. 11.3.4.2. Unique Values in an Index Field
        3. 11.3.4.3. Remove Redundant Indexes
        4. 11.3.4.4. Use the Smallest Possible Data Type
        5. 11.3.4.5. Only Retrieve What You Need
        6. 11.3.4.6. Use the EXPLAIN Command
      5. 11.3.5. Profiling the Existing System
    4. 11.4. Administration
      1. 11.4.1. LDAP Authentication
        1. 11.4.1.1. Joomla LDAP Plug-In
        2. 11.4.1.2. OpenLDAP
    5. 11.5. Maintenance
      1. 11.5.1. Cleaning Joomla
        1. 11.5.1.1. Using the Article Manager to Find Unpublished Articles and Menus
      2. 11.5.2. Direct MySQL Access
        1. 11.5.2.1. Finding Old Content
        2. 11.5.2.2. Finding Inactive Users
        3. 11.5.2.3. Finding Empty Data Fields
        4. 11.5.2.4. Finding Unpublished Articles and Menus
        5. 11.5.2.5. Finding Most Recent Polls
        6. 11.5.2.6. Finding Empty Sections and Categories
    6. 11.6. Summary
  17. 12. Interfacing with Outside Content
    1. 12.1. Pulling in External Content
      1. 12.1.1. Web Feeds
        1. 12.1.1.1. Web Feed Format
        2. 12.1.1.2. Joomla Feed Subscription Module
        3. 12.1.1.3. Joomla Syndication Publishing Module
      2. 12.1.2. Auto Articles 3000 Extension
    2. 12.2. Managing Affiliate Programs
      1. 12.2.1. Google AdSense Affiliate Program
      2. 12.2.2. Amazon Affiliate Program
        1. 12.2.2.1. Amazon Associates Extension
        2. 12.2.2.2. Amazon Products Feed Bridge
    3. 12.3. Business Interaction with EDI
      1. 12.3.1. EDI Documents
      2. 12.3.2. EDI Standards
      3. 12.3.3. Skylark Extension
    4. 12.4. Custom Extranet Interaction
      1. 12.4.1. Screen Scraper Component
        1. 12.4.1.1. Brief History of Screen Scrapers
        2. 12.4.1.2. Pitfalls of Using a Screen Scraper
        3. 12.4.1.3. Basic Component Source File
        4. 12.4.1.4. Component Descriptor File
        5. 12.4.1.5. Scraper Component
      2. 12.4.2. Google Map Component
        1. 12.4.2.1. Google Maps API Primer
        2. 12.4.2.2. Registering for a Key
        3. 12.4.2.3. Component Descriptor File
        4. 12.4.2.4. Creating the Component Index File
      3. 12.4.3. Postal Address Finder with XML
        1. 12.4.3.1. Manual Testing
        2. 12.4.3.2. Implementing a PHP Test Page
        3. 12.4.3.3. Component Descriptor File
        4. 12.4.3.4. Creating the Component Index File
    5. 12.5. Summary
  18. 13. Search Engine Optimization (SEO) and Search Engine Marketing (SEM)
    1. 13.1. Joomla Settings
      1. 13.1.1. Search Engine Friendly (SEF) URLs
      2. 13.1.2. Metadata
        1. 13.1.2.1. Site Metadata
        2. 13.1.2.2. Article Metadata
      3. 13.1.3. Activating Breadcrumbs
      4. 13.1.4. Sitemap
        1. 13.1.4.1. Joomla Sitemap Extensions
        2. 13.1.4.2. Google Sitemaps
    2. 13.2. General Techniques
      1. 13.2.1. Dominant Search Engines
      2. 13.2.2. Performing Keyword Research
        1. 13.2.2.1. Creating a Keyword Starter List
        2. 13.2.2.2. Using a Keyword Finder Tool
        3. 13.2.2.3. Finding the Sweet-Spot Keywords
        4. 13.2.2.4. Look at the Top Pages
      3. 13.2.3. Page Titles
      4. 13.2.4. alt Attribute for Images and Other Media
      5. 13.2.5. Google Page Rank
      6. 13.2.6. Reciprocal Links
      7. 13.2.7. Ajax and SEO
      8. 13.2.8. Google Analytics
      9. 13.2.9. What Not to Do
    3. 13.3. Search Engine Marketing (SEM)
      1. 13.3.1. Writing an Effective Ad
      2. 13.3.2. Pay-per-Click and Impression Advertising
      3. 13.3.3. Google Adsense
    4. 13.4. Summary
  19. 14. Joomla! Security
    1. 14.1. Types of Attack
      1. 14.1.1. Password Attacks
      2. 14.1.2. SQL Injection
        1. 14.1.2.1.
          1. 14.1.2.1.1. Unfiltered Text Fields
      3. 14.1.3. Handling Text Fields in Joomla and PHP
        1. 14.1.3.1. Untyped Fields
      4. 14.1.4. Custom Requests — Especially Through Ajax
      5. 14.1.5. Cross-Site Scripting (XSS)
      6. 14.1.6. Directory Scanning
      7. 14.1.7. Denial of Service (DoS) Attack
      8. 14.1.8. HTTP Sniffing
    2. 14.2. Web Server Security
      1. 14.2.1. Securing Apache Server
        1. 14.2.1.1. .htaccess Configuration
        2. 14.2.1.2. ServerSignature Directive
        3. 14.2.1.3. ServerTokens Directive
      2. 14.2.2. Denying Access to File Extensions
    3. 14.3. PHP Security
      1. 14.3.1. PHP Safe Mode
      2. 14.3.2. PHP doc_root
      3. 14.3.3. PHP disable_functions
      4. 14.3.4. PHP disable_classes
      5. 14.3.5. PHP display_errors
      6. 14.3.6. PHP expose_php
    4. 14.4. MySQL Security
    5. 14.5. Joomla Security
      1. 14.5.1. Delete Installation Files
      2. 14.5.2. Joomla HTML Editor
      3. 14.5.3. Execution within the System
      4. 14.5.4. Testing and Development
    6. 14.6. Summary
  20. 15. What Joomla! Can't Do
    1. 15.1. Document Version Control
    2. 15.2. Import, File Conversion, and Export
    3. 15.3. Limited Security and Authentication Features
    4. 15.4. Load Balancing and Replication
    5. 15.5. User Interface Levels and Skinning
    6. 15.6. Standard Groupware Capabilities
    7. 15.7. Portal Capabilities
    8. 15.8. Summary
  21. 16. Spotlight on Successful Joomla! Sites
    1. 16.1. Academic Sites
      1. 16.1.1. Princeton Molecular Biology Department
      2. 16.1.2. Shakespeare Birthplace Trust
      3. 16.1.3. Journal of Intercultural and Interdisciplinary Archaeology
      4. 16.1.4. Graphic User Interactive Learning and Development (GUILD)
      5. 16.1.5. Virgin Islands Department of Education
    2. 16.2. Family/Health Sites
      1. 16.2.1. SeniorNet
      2. 16.2.2. KidsCHANNEL
      3. 16.2.3. A Story for Bedtime
      4. 16.2.4. Second Wives Club
      5. 16.2.5. Better Health Here
    3. 16.3. Professional Sites
      1. 16.3.1. World Cup 2010 South Africa
      2. 16.3.2. Best Association Resources and Tools
      3. 16.3.3. Randall Wood Travel Writing Site
      4. 16.3.4. Turbo Trade
      5. 16.3.5. Sonnetto
      6. 16.3.6. John Avon Illustration
    4. 16.4. Media (News, Magazines, and so on) Sites
      1. 16.4.1. MainSPOT.NET
      2. 16.4.2. PanNatural Environmental News Source
      3. 16.4.3. United Nations Regional Information Centre for Western Europe
      4. 16.4.4. HCJB Global
      5. 16.4.5. Asiaing.com
      6. 16.4.6. The Chaser
      7. 16.4.7. Creative Guy Publishing
    5. 16.5. Hobbyist Sites
      1. 16.5.1. Success and Sport (S.A.S.)
      2. 16.5.2. Safari Ventures
      3. 16.5.3. Sky Systems
      4. 16.5.4. KISSin' UK
      5. 16.5.5. Calialive.com
    6. 16.6. Technology Sites
      1. 16.6.1. Joomla Main Site
      2. 16.6.2. VOIPSpeak.net
      3. 16.6.3. Open Workbench
      4. 16.6.4. Joomlahut
      5. 16.6.5. OScar Project (Open Source Car)
    7. 16.7. Summary