You are previewing CodeIgniter for Rapid PHP Application Development.
O'Reilly logo
CodeIgniter for Rapid PHP Application Development

Book Description

"

Improve your PHP coding productivity with the free compact open-source MVC CodeIgniter framework!

  • Clear, structured tutorial on working with CodeIgniter

  • Careful explanation of the basic concepts of CodeIgniter and its MVC architecture

  • Using CodeIgniter with databases, HTML forms, files, images, sessions, and email

  • Building a dynamic website quickly and easily using CodeIgniter's prepared code

  • In Detail

    CodeIgniter (CI) is a powerful open-source PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. CodeIgniter is an MVC framework, similar in some ways to the Rails framework for Ruby, and is designed to enable, not overwhelm.

    This book explains how to work with CodeIgniter in a clear logical way. It is not a detailed guide to the syntax of CodeIgniter, but makes an ideal complement to the existing online CodeIgniter user guide, helping you grasp the bigger picture and bringing together many ideas to get your application development started as smoothly as possible.

    Improve your PHP coding productivity with this guide to the powerful and popular CodeIgniter framework.

    "

    Table of Contents

    1. CodeIgniter for Rapid PHP Application Development
    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. Conventions
      4. Reader Feedback
      5. Customer Support
      6. Downloading the Example Code for the Book
        1. Errata
        2. Questions
    6. 1. Introduction to CodeIgniter
      1. What can CodeIgniter Do for You?
        1. Save Time
        2. Make Your Site More Robust
          1. Keep Your Links Up-To-Date Automatically
          2. Save Database Crashes: 'prep' Your Data Entry Forms
        3. Make Your Code Bolder
          1. Send Email Attachments without Hassles
          2. Save Bandwidth by Zipping Files That Users Need to Download
      2. Yes, But…What is CodeIgniter? What are Frameworks?
      3. And Who is That Man?
      4. The 'Open Source' Business Model
      5. What CI Doesn't Do
      6. License
      7. Summary
    7. 2. Two Minutes' Work: Setting up a CodeIgniter Site
      1. Prerequisites
      2. Installing CodeIgniter
      3. Exploring the File Structure
      4. The Configuration File
      5. Does it Work?
      6. Summary
    8. 3. Navigating Your Site
      1. MVC - Just Another Acronym?
      2. The Structure of a CI Site: Controllers and Views
        1. The Welcome Controller
        2. Working with Views
        3. The Default Controller
      3. CodeIgniter Syntax Rules
        1. Controller
        2. View
      4. Types of Files or Classes on a CI Site
      5. What are All Those Folders For?
      6. Designing a Better View
      7. Designing a Better Controller
        1. Getting Parameters to a Function
        2. Passing Data to a View
      8. How CI Classes Pass Information and Control to Each Other
        1. Calling Views
        2. Calling Functions Directly
        3. Interacting with Controllers
        4. It's Just Like an Egg-Cup
        5. An Example of a CI Helper: the URL Helper
        6. A Simple Library Example: Creating a Menu
      9. Summary
    9. 4. Using CI to Simplify Databases
      1. Configuration Settings
      2. Designing the Database for Our Site
      3. Active Record
        1. Advantages of Using the Active Record Class
          1. Saving Time
          2. Automatic Functionality
        2. Read Queries
        3. Displaying Query Results
        4. Create and Update Queries
        5. Delete Queries
        6. Mixing Active Record and 'Classic' Styles
      4. Summary
      5. Chapter Appendix: MYSQL Query to Set Up 'websites' Database
    10. 5. Simplifying HTML Pages and Forms
      1. Writing a View
      2. Long and Short PHP Syntax
      3. Nesting Views
      4. Practical Issues of Site Architecture
      5. CI's Form Helper: Entering Data
        1. Form Helper Advantage One: Clarity
        2. Form Helper Advantage Two: Automation
      6. My 'Display' Model
      7. CI's Validation Class: Checking Data Easily
        1. Set Up Validation
        2. Set Up the Controller
        3. Set Up the Forms
      8. Summary
    11. 6. Simplifying Sessions and Security
      1. Starting to Design a Practical Site with CI
      2. Moving Around the Site
      3. Security/Sessions: Using Another CI Library Class
        1. Turning Sessions into Security
      4. Security
      5. Summary
    12. 7. CodeIgniter and Objects
      1. Object-Oriented Programming
        1. Working of the CI 'Super-Object'
        2. Copying by Reference
      2. Adding Your own Code to the CI 'Super-Object'
      3. Problems with the CI 'Super-Object'
      4. Summary
    13. 8. Using CI to Test Code
      1. Why Test, and What For?
      2. CI's Error Handling Class
      3. CI's Unit Test Class
        1. When to Use Unit Tests
        2. Example of a Unit Test
      4. CI's Benchmarking Class
      5. CI's Profiler Class
      6. Testing with Mock Databases
      7. Control and Timing
      8. Summary
    14. 9. Using CI to Communicate
      1. Using the FTP Class to Test Remote Files
      2. Machines Talking to Machines Again XML-RPC
          1. Getting the XML-RPC Server and Client in Touch with Each Other
          2. Formatting XML-RPC Exchanges
          3. Debugging
          4. Issues with XML-RPC?
      3. Talking to Humans for a Change: the Email Class
      4. Summary
    15. 10. How CI Helps to Provide Dynamic Information
      1. The Date Helper: Converting and Localizing Dates
      2. Working with Text: the Text Helper and Inflector Helper
      3. Going International: the Language Class
      4. Making HTML Tables the Easy Way: the Table Class
      5. Caching Pages
      6. Summary
    16. 11. Using CI to Handle Files and Images
      1. The File Helper
      2. The Download Helper
      3. The File Upload Class
      4. CI's Image Class
      5. Easy File Compression with the CI Zip Class
      6. Summary
    17. 12. Production Versions, Updates, and Big Decisions
      1. Connections: Check the Config Files
        1. URLs
        2. Databases
        3. Other config Files
      2. Look Out for PHP 4/5 and Operating System Differences
        1. Diagnostic Tools
      3. Coping with Change in New CI Versions
        1. How to Load Models, and What to Call Them
        2. How to Initialize Your Own 'library' Classes
      4. So Should I Update If a New CI Version Comes Out?
      5. How to Add On to CI's Basic Classes
      6. Summary
    18. 13. Instant CRUD or Putting it All Together
      1. The CRUD Model: Design Philosophy
      2. The Standard Controller Format
      3. The Database Tables
      4. The Heart of the Model: the Array
      5. Function by Function: the CRUD Model
        1. Showall
          1. Reading the Data
          2. Delete and Trydelete
        2. Insert
        3. Insert2
        4. The Test Suite
      6. Summary
    19. 14. The Verdict on CI
      1. Some Code: the 'do_test' Model
      2. A Balance Sheet
        1. Where CI Helped: Structure
        2. Where CI Helped: Simplicity
        3. Where CI Helped: Extra Functionality
      3. Problems with CI
        1. Completeness
        2. Ease of Use
      4. Summary
    20. 15. Resources and Extensions
      1. CI's User Forums
      2. Video Tutorials
        1. Available Plug-ins and Libraries
        2. AJAX/JavaScript
        3. Authentication
        4. External Sites
        5. Comparisons: Which Charting Library to Use?
        6. CRUD: the Final Frontier
      3. Resources for Other Programmes, e.g. Xampplite, MySQL, PHP
      4. Summary