PacktLib: CakePHP Application Development

CakePHP Application Development

Credits

About the Authors

About the Reviewer

Preface

Introduction to CakePHP

What is CakePHP?

Improved Code Structure

Faster Development

Versions of CakePHP: 1.1 and 1.2

Summary

A Quick Installation

Downloading CakePHP

Platform Requirements

Configuring Apache

Setting Up Cake in Web Root

Running Cake for the First Time

Summary

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

Summary

Controllers: Programming Application Logic

Interacting with Model

Action, Parameters, and Views

Actions and Parameters

Getting Post Data from the View

Redirecting

AppController: The Parent Controller

Working with Components

Summary

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

Summary

ORM: Modelling the Table Relationship

Working with Simple Associations

Working with Complex Associations

Summary

Views: Creating User Interfaces

Working with Layouts

Using Elements

Working with Helpers

Creating Forms to Take User Input

Summary

Using Shells: Get Further, Faster

Setting Up the Cake Shell

Baking an Application

Summary

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

Summary

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

Summary

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

Summary

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

Summary

Index