Free Sample
+ Collection

CodeIgniter 2 Cookbook

Rob Foster

As a PHP developer, you may have wondered how much difference the Codeigniter framework might make when creating web applications. Now you can find out with a host of customizable recipes ready to insert into your own work.
RRP $29.99
RRP $49.99
Print + eBook

Want this title & more?

$12.99 p/month

Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.

Book Details

ISBN 139781782162308
Paperback306 pages

About This Book

  • Customizable code that can be used in your own applications right away
  • Recipes that will help you solve your Codeigniter issues efficiently and effectively
  • Each recipe comes with a full code example, and where necessary, the Model and View files are included too

Who This Book Is For

CodeIgniter 2 Cookbook is for intermediate to advanced PHP developers who want to begin using the powerful CodeIgniter framework to create web applications. Familiarity with CodeIgniter isn’t essential, but it will be useful if you have been introduced to the framework before.

Table of Contents

Chapter 1: CodeIgniter Basics
Downloading and installing CodeIgniter
Basic configuration options
Chapter 2: User Management
Viewing users
Creating users
Editing users
Deleting users
Generating passwords with CodeIgniter
Generating passwords with CodeIgniter – the bare bones
Forgot password? – resetting passwords with CodeIgniter
Chapter 3: Creating E-commerce Features
Amending configuration settings to run sessions in a database
Creating a basic cart
Adding and searching by product categories
Saving the cart to the database
Chapter 4: Email, HTML Table, and Text Libraries
Sending plain e-mails with CodeIgniter Email
Sending HTML e-mails with CodeIgniter Email
Sending attachments with CodeIgniter Email
Sending bulk e-mails with CodeIgniter Email
Using an HTML table with DataTable
Using an HTML table with DataTable and a database
Using word_limiter() for table output
Using word_censor() for cleaning input
Chapter 5: Managing Data In and Out
Sending different data to multiple views
Validating user input
Preparing user input
Sticky form elements in CodeIgniter
Displaying errors next to form items
Reading files from the filesystem
Writing files to the filesystem
Creating and downloading ZIP files
Uploading files with CodeIgniter
Creating and using validation callbacks
Using the language class
Confirming cookie acceptance from the user
Chapter 6: Working with Databases
Configuring CodeIgniter for databases
Connecting to multiple databases
Active Record – create (insert)
Active Record – read (select)
Active Record – update
ActiveRecord – delete
Looping through the database results
Counting the number of returned results with num_rows()
Counting the number of returned results with count_all_results()
Query binding
Finding the last insert id
Finding the number of affected rows
Finding the last database query
Using CodeIgniter database migrations
Moving to the current version with current()
Rolling back/stepping forward with version()
Generating an XML from a database result
Generating a CSV from a database result
Chapter 7: Creating a Secure User Environment
Escaping user input
Preventing cross-site request forgery
Escaping data – for a database
Using HTTPS with CodeIgniter
Chapter 8: Calendaring, Right Place, and Right Time
Building a CodeIgniter Calendar helper with database results
Building an appointment manager with Calendar Library
Creating a helper to work with a person's date of birth
Working with fuzzy dates in CodeIgniter
Chapter 9: Extending the Core
Using CodeIgniter Sparks
Creating PDFs with the DOMPDF Spark
Creating Hooks in CodeIgniter
Clearing dead sessions from the database
Extending your controllers
Uploading a file with FTP
Creating libraries and giving them access to CodeIgniter resources
Making your own configuration files and using the settings
Using the language class – switching language on the go
Chapter 10: Working with Images
Installing ImageMagick on MAC with Cactuslab
Uploading images with CodeIgniter
Generating thumbnails – resizing
Rotating images
Cropping images
Adding watermarks with text
Adding watermarks with image overlays
Submitting a form with CodeIgniter CAPTCHA
Chapter 11: SEO, Caching, and Logging
Using SEO-friendly URLs in CodeIgniter
Using CodeIgniter caching
Logging errors with CodeIgniter
Benchmarking your application

What You Will Learn

  • Build simple yet powerful PHP and CodeIgniter applications
  • Create e-commerce features to add to your application
  • Manipulate images – crop, rotate, and add watermarks
  • Secure your user environment
  • Provide a forgot password functionality to users
  • Optimize your SEO and search capabilities
  • Manage money flow in your application
  • Work with the EU Cookie Law (confirming Cookies from the user)
  • Use database migrations to roll back changes and advance to newer database versions

In Detail

As a developer, there are going to be times when you’ll need a quick and easy solution to a coding problem. CodeIgniter is a powerful open source PHP framework which allows you to build simple yet powerful full-feature web applications.

CodeIgniter 2 Cookbook will give you quick access to practical recipes and useful code snippets which you can add directly into your CodeIgniter application to get the job done. It contains over 80 ready-to-use recipes that you can quickly refer to within your CodeIgniter application or project.

This book is your complete guide to creating fully functioning PHP web applications, full of easy-to-follow recipes that will aid you in any aspect of developing with CodeIgniter. CodeIgniter 2 Cookbook takes you from the basics of CodeIgniter, through e-commerce features for your applications, and ends by helping you ensure that your environment is secure for your users and SEO friendly to draw in customers.

Starting with installation and setup, CodeIgniter 2 Cookbook provides quick solutions to programming problems that you can directly include in your own projects. You will be moving through databases, EU Cookie Law, caching, and everything else in-between with useful, ready-to-go recipes. You will look at image manipulation using the Image Manipulation library, user management (building a simple CRUD interface), switching languages on the fly according to the user preference, caching content to reduce server load, and much more.


Read More