PacktLib: CakePHP Application Development

CakePHP Application Development


About the Authors

About the Reviewer


Introduction to CakePHP

What is CakePHP?

Improved Code Structure

Faster Development

Versions of CakePHP: 1.1 and 1.2


A Quick Installation

Downloading CakePHP

Platform Requirements

Configuring Apache

Setting Up Cake in Web Root

Running Cake for the First Time


A Quick App

Making Sure the Oven is Ready

CakeTooDoo: a Simple To-do List Application

Configuring Cake to Work with a Database

Writing our First Model

Writing our First Controller

Viewing All Tasks in CakeTooDoo

Adding a New Task

Editing a Task

Adding Data Validation

Deleting a Task from CakeTooDoo

Viewing Completed Tasks and Pending Tasks

Formatting Date and Time

Creating the CakeTooDoo Homepage


Controllers: Programming Application Logic

Interacting with Model

Action, Parameters, and Views

Actions and Parameters

Getting Post Data from the View


AppController: The Parent Controller

Working with Components


Models: Accessing Data

Setting Up Database and Models

Retrieving Data

Saving and Updating Data

Deleting Data

Placing Your Own Logic Inside Model

Validating Your Data


ORM: Modelling the Table Relationship

Working with Simple Associations

Working with Complex Associations


Views: Creating User Interfaces

Working with Layouts

Using Elements

Working with Helpers

Creating Forms to Take User Input


Using Shells: Get Further, Faster

Setting Up the Cake Shell

Baking an Application


Making Quickwall: The Basics

What is This Quickwall All About?

Setting Up Cake

Creating and Connecting the Database

Creating and Defining Relationships between Models

Creating the Basic Controller Actions and Their Views

Adding Custom Layout

Adding Forms to Add New Questions and Answers


Quickwall: User Authentication

Creating the User Model and the Users Controller

Making the User Sign Up Process

Adding Email Confirmation to Sign Up

Integrating Authentication: Database and Models

Integrating Authentication: Controllers

Integrating Authentication: Views

Remembering User with Cookie


Quickwall: JavaScript and AJAX

Adding JavaScript Validation

AJAX Link to Show Own Questions

AJAX AutoComplete to Search Users

AJAX Form Submit to View Questions of a User

In-Line Editing to Edit Own Answers


Quickwall: Making It Better

Making Dates More Readable

Creating a User Page

Linking the Search Page to the User Page

Adding Pagination

Adding RSS Feeds