Table of Contents
Preface
Introduction to CakePHP
A Quick Installation
A Quick App
Controllers: Programming Application Logic
Models: Accessing Data
ORM: Modelling the Table Relationship
Views: Creating User Interfaces
Using Shells: Get Further, Faster
Making Quickwall: The Basics
Quickwall: User Authentication
Quickwall: JavaScript and AJAX
Quickwall: Making It Better
Index
- Preface
- What This Book Covers
- Who is This Book for
- Conventions
- Reader Feedback
- Customer Support
- Downloading the Example Code for the Book
- Errata
- Questions
- Introduction to CakePHP
- What is CakePHP?
- A PHP Framework
- Common Design Patterns
- Rapid Web Development
- Works with PHP4 and PHP5
- CakePHP is Free and Open Source
- Improved Code Structure
- Understanding the MVC Pattern
- Models
- Controllers
- Views
- How It Works
- Faster Development
- Less Configuration, More Convention
- Auto Code Generation
- Quick Access to Related Data
- Built-in Commonly Used Functionalities
- Versions of CakePHP: 1.1 and 1.2
- Summary
- What is CakePHP?
- A Quick Installation
- Downloading CakePHP
- Platform Requirements
- Configuring Apache
- AllowOverwrite is Set to All
- Mod_rewrite Module is Loaded
- 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
- Attaching Models and Controllers
- Action, Parameters, and Views
- Interacting with View
- Actions and Parameters
- Getting Post Data from the View
- Redirecting
- AppController: The Parent Controller
- Working with Components
- Summary
- Interacting with Model
- Models: Accessing Data
- Setting Up Database and Models
- Creating a Model for a Database Table
- Retrieving Data
- Using Model to Retrieve Data
- More on Data Retrieval
- Saving and Updating Data
- Saving Data
- Updating a Record
- More on the save() Method
- Updating a Single Field
- Batch Update
- Deleting Data
- Deleting a Single Record
- Placing Your Own Logic Inside Model
- Create and Use Your Own Model Method
- Validating Your Data
- Adding Validation to Our Model
- Summary
- Setting Up Database and Models
- ORM: Modelling the Table Relationship
- Working with Simple Associations
- Defining One-To-Many Relationship in Models
- Retrieving Related Model Data in One-To-Many Relation
- Saving Related Model Data in One-To-Many Relation
- Adding More than One Association of the Same Type
- One-To-One Relation
- Customizing Association Characteristics
- Working with Complex Associations
- Defining Many-To-Many Relationship in Models
- Retrieving Related Model Data in Many-To-Many Relation
- Saving Related Model Data in Many-To-Many Relation
- Deleting Associated Data
- Changing Association On The Fly
- Summary
- Working with Simple Associations
- Views: Creating User Interfaces
- Working with Layouts
- Creating Custom Layouts
- Using Elements
- Creating and Using Element
- Working with Helpers
- Creating and Using Your Own Helper
- Creating Forms to Take User Input
- Summary
- Working with Layouts
- Using Shells: Get Further, Faster
- Setting Up the Cake Shell
- Setting Up the Cake Shell in Windows
- Setting Up the Cake Shell in *nix
- Baking an Application
- Creating and Configuring the Database
- Baking Models
- Baking Controllers
- Baking Views
- Summary
- Setting Up the Cake Shell
- 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