PacktLib: CodeIgniter 2 Cookbook

CodeIgniter 2 Cookbook


About the Author

About the Reviewers


CodeIgniter Basics


Downloading and installing CodeIgniter

Basic configuration options

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

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

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

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

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

Creating a Secure User Environment


Escaping user input

Preventing cross-site request forgery

Escaping data – for a database

Using HTTPS with CodeIgniter

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

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

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

SEO, Caching, and Logging


Using SEO-friendly URLs in CodeIgniter

Using CodeIgniter caching

Logging errors with CodeIgniter

Benchmarking your application