CodeIgniter 1.7

Book description

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

  • Clear, structured tutorial on working with CodeIgniter for rapid PHP application development

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

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

  • Full of ideas and examples with instructions making it ideal for beginners to CodeIgniter

  • Full of ideas and examples with instructions making it ideal for beginners to CodeIgniter

  • 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.

    This book will start you from the basics, installing CodeIgniter, understanding its structure and the MVC pattern. You will also learn how to use some of the most important CodeIgniter libraries and helpers, upload it to a shared server, and take care of the most common problems. If you are new to CodeIgniter, this book will guide you from bottom to top. If you are an experienced developer or already know about CodeIgniter, here you will find ideas and code examples to compare to your own.

    Table of contents

    1. CodeIgniter 1.7
      1. CodeIgniter 1.7
      2. Credits
      3. About the Authors
      4. About the Reviewer
      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. 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. Preventing database SQL injection attacks and form prepping
            3. Protect your site from XSS attacks
          3. Make your code bolder
            1. Send email attachments without hassles
            2. Save bandwidth by zipping files that users need to download
        2. What CI doesn't do
        3. Yes, but…what is CodeIgniter? What are frameworks?
        4. Comparing CI to other open source solutions (CakePHP and Joomla!)
          1. What to choose
        5. License
        6. Summary
      7. 2. Setting up a CodeIgniter Site
        1. Prerequisites
        2. Installing CodeIgniter
          1. Exploring the file structure
          2. Does it work?—checking our CI installation
          3. The configuration file
          4. Autoloading libraries, helpers, and so on
          5. Mod rewrite and apache .htaccess to achieve nice URL rewrites
          6. Moving the application directory and the system directory—benefits
        3. Summary
      8. 3. Navigating Your Site
        1. MVC: Model-View-Controller
          1. But how does all this work?
            1. The welcome controller
            2. Working with views
            3. The default controller
          2. CodeIgniter syntax rules
            1. Controller
            2. View
          3. Types of files or classes on a CI site
          4. Designing a better view
          5. Designing a better controller
            1. Getting parameters to a function
            2. Passing data to a view
          6. How CI classes pass information and control to each other
            1. Calling views
            2. Calling functions directly
            3. Interacting with controllers
            4. An example of a CI helper—the URL helper
            5. A simple library example—creating a menu
        2. 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
            3. Read queries
            4. Displaying query results
            5. Create and update queries
            6. Delete queries
          2. Mixing Active Record and "classic" styles
          3. Dealing with complex queries
        4. Summary
        5. Chapter appendix: MySQL query to set up the website's database
      10. 5. Simplifying HTML Pages and Forms
        1. Writing a view
        2. Long and short PHP syntax and other CodeIgniter style guidelines
          1. File format
          2. PHP closing tag
        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 form validation class: Checking data easily
          1. Setting up validation
          2. Setting up the controller
          3. Setting up forms
          4. Let's pack it all together
        8. Summary
      11. 6. Simplifying Sessions and Security
        1. Continuing with our practical site using CI
          1. Moving around the site
        2. Security/Sessions: Using another CI library class
          1. Turning sessions into security
          2. But what about logout?
        3. Isn't there anything already built?
        4. Security
        5. Summary
      12. 7. CodeIgniter and Objects
        1. Object-oriented programming
          1. The CI super-object
            1. Copying by reference
            2. Adding your own code to the CI super-object
            3. Problems with the CI super-object
        2. Summary
      13. 8. Improving Our Application with Third-Party Code
        1. Creating a helper
        2. Creating a library
          1. Sitemap
          2. Explanation for My_Parser.php
          3. Google charts plugin
        3. 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. Twitter
        5. Summary
      15. 10. How CI Helps to Provide Dynamic Information
        1. The date helper—converting and localizing dates
          1. The Calendar class
        2. Working with text—the text helper
          1. Going international—the Language class
        3. Making HTML tables the easy way—the Table class
        4. Caching pages
        5. Summary
      16. 11. Using CI to Handle Files and Images
        1. The file helper
        2. The download helper
        3. The file upload class and CI's image class
        4. CI's image class
        5. Easy file compression with CI's zip class
        6. Summary
      17. 12. Moving Your Site to the WWW
        1. Errors and error pages
        2. So, should we update if a new version of CI comes out?
          1. Steps/advice to follow when updating our CI version
        3. Summary
      18. 13. CRUD—or Putting It All Together
        1. Building our CRUD controller, model, and views
        2. Upgrading our CRUD
          1. Pagination class
          2. Putting some order into our records
        3. Summary
      19. 14. The Verdict on CI
        1. Organizing the files of our site
        2. Organizing the logic of our site
          1. A model
          2. A controller
          3. A view
        3. Centralized configuration
        4. Code conventions
        5. Database tools
        6. Simpler and more powerful code
        7. Adding security to our site
        8. Making our site more scalable and our code more reusable
        9. Documentation and community
        10. Summarizing all that CI offers
        11. Summary
      20. 15. Resources and Extensions
        1. CI's user forums
          1. Video tutorials
          2. Available plugins and libraries
            1. AJAX or JavaScript
            2. Authentication
            3. PDF generation
            4. Comparisons: Which charting library to use?
            5. HTML purifier
            6. CRUD—the final frontier
        2. Invoicing
        3. Additional resources
          1. Some books that could help
          2. Resources for other programs: XAMPP Lite, MySQL, and PHP
        4. Summary
      21. A. Appendix
        1. What we need to use the library
        2. Adding products to the cart
        3. Showing the cart to our clients
        4. Summary

    Product information

    • Title: CodeIgniter 1.7
    • Author(s):
    • Release date: November 2009
    • Publisher(s): Packt Publishing
    • ISBN: 9781847199485