Documentation
CookBook
API
Videos
Privacy Policy
Logos & Trademarks
Business Solutions
Swag
Road Trip
Team
Community
Community
Team
Issues (Github)
YouTube Channel
Get Involved
Bakery
Newsletter
Certification
My CakePHP
CakeFest
Facebook
Twitter
Help & Support
Forum
Stack Overflow
IRC
Slack
Paid Support
B
CakePHP 1.3
Cookbook
A
Language:
en
pt
es
ja
fr
Version:
1.3
3.x Book
2.x Book
1.3 Book
1.2 Book
1.1 Book
Table of Contents
×
Improve This Doc
Contents
ΒΆ
The Manual
How You Can Help
Translations
Beginning With CakePHP
What is CakePHP? Why Use it?
Where to Get Help
The Official CakePHP website
The Cookbook
The Bakery
The API
CakeForge
The Test Cases
The IRC channel
The Google Group
Understanding Model-View-Controller
Benefits
Basic Principles of CakePHP
CakePHP Structure
Controller Extensions (“Components”)
View Extensions (“Helpers”)
Model Extensions (“Behaviors”)
Application Extensions
A Typical CakePHP Request
CakePHP Folder Structure
The App Folder
CakePHP Conventions
File and Classname Conventions
Model and Database Conventions
Controller Conventions
View Conventions
Developing with CakePHP
Requirements
Installation Preparation
Getting CakePHP
Permissions
Installation
Development
Production
Advanced Installation
Apache and mod_rewrite (and .htaccess)
Pretty URLs and Lighttpd
Pretty URLs on nginx
URL Rewrites on IIS7 (Windows hosts)
Fire It Up
Configuration
Database Configuration
Core Configuration
The Configuration Class
The App Class
Routes Configuration
Inflections
Bootstrapping CakePHP
Controllers
Introduction
The App Controller
The Pages Controller
Controller Attributes
Controller Methods
Components
Introduction
Configuring Components
Creating Components
Models
Understanding Models
Creating Database Tables
Retrieving Your Data
Saving Your Data
Deleting Data
Associations: Linking Models Together
Callback Methods
Model Attributes
Additional Methods and Properties
Virtual fields
Transactions
Behaviors
Using Behaviors
Creating Behaviors
Creating behavior methods
Behavior callbacks
Creating a behavior callback
DataSources
Basic API For DataSources
An Example
Plugin DataSources and Datasource Drivers
Views
View Templates
Layouts
Elements
View methods
Themes
Media Views
Helpers
Using Helpers
Creating Helpers
Creating Functionality for All Helpers
Core Helpers
Scaffolding
Creating a simple admin interface with scaffolding
Customizing Scaffold Views
The CakePHP Console
Creating Shells & Tasks
Running Shells as cronjobs
Plugins
Creating a Plugin
Plugin Controllers
Plugin Models
Plugin Views
Components, Helpers and Behaviors
Plugin assets
Plugin Tips
Global Constants and Functions
Global Functions
Core Definition Constants
Vendor packages
Vendor assets
Common Tasks With CakePHP
Data Validation
Simple Rules
One Rule Per Field
Multiple Rules per Field
Core Validation Rules
Custom Validation Rules
Validating Data from the Controller
Data Sanitization
paranoid
html
escape
clean
Error Handling
Debugging
Basic Debugging
Using the Debugger Class
Debugger Class
Caching
Logging
Writing to logs
Using the default FileLog class
Creating and configuring log streams
Interacting with log streams
Error logging
Testing
Preparing for testing
Testing overview - Unit testing vs. Web testing
Preparing test data
Creating tests
Testing models
Testing controllers
Testing Helpers
Testing components
Web testing - Testing views
Testing plugins
Miscellaneous
Running tests in the Command Line
Test Suite changes in 1.3
Internationalization & Localization
Internationalizing Your Application
Localization in CakePHP
Pagination
Controller Setup
Pagination in Views
AJAX Pagination
Custom Query Pagination
REST
The Simple Setup
Custom REST Routing
Core Components
Access Control Lists
Understanding How ACL Works
Defining Permissions: Cake’s INI-based ACL
Defining Permissions: Cake’s Database ACL
Now that we’ve covered INI-based ACL permissions, let’s move on to the (more commonly used) database ACL.
Authentication
Setting Auth Component Variables
Displaying Auth Error Messages
Troubleshooting Auth Problems
Change Hash Function
AuthComponent Methods
AuthComponent Variables
allowedActions
Cookies
Controller Setup
Using the Component
Email
Class Attributes and Variables
Sending a basic message
Sending A Message Using SMTP
Request Handling
Obtaining Request Information
Request Type Detection
Obtaining Additional Client Information
Responding To Requests
Security Component
Configuration
Methods
Usage
Basic HTTP Authentication
Sessions
Methods
Core Behaviors
ACL
Using the AclBehavior
node()
Containable
Using Containable
Containing deeper associations
Using Containable with pagination
ContainableBehavior options
Translate
Initializing the i18n Database Tables
Attaching the Translate Behavior to your Models
Defining the Fields
Conclusion
Retrieve all translation records for a field
Saving in another language
Multiple Translation Tables
Tree
Requirements
Basic Usage
Advanced Usage
Data Integrity
Core Helpers
AJAX
AjaxHelper Options
Methods
Cache
General Caching
Cache Engines in Cake
Cache Helper Configuration
Caching in the Controller
Marking Non-Cached Content in Views
Clearing the Cache
Form
Creating Forms
Closing the Form
Automagic Form Elements
File Fields
Form Element-Specific Methods
1.3 improvements
HTML
Inserting Well-Formatted elements
Changing the tags output by HtmlHelper
Creating breadcrumb trails with HtmlHelper
Js
Using a specific Javascript engine
Creating a Javascript Engine
Javascript engine usage
Methods
Ajax Pagination
Javascript
Methods
Number
currency
precision
toPercentage
toReadableSize
format
Paginator
Methods
RSS
Creating an RSS feed with the RssHelper
Session
Methods
flash
Text
autoLinkEmails
autoLinkUrls
autoLink
excerpt
highlight
stripLinks
toList
truncate
trim
Time
Formatting
Testing Time
XML
serialize
elem
header
Core Utility Libraries
App
Inflector
Class methods
String
uuid
tokenize
insert
cleanInsert
Xml
Xml parsing
Set
Set-compatible Path syntax
insert
sort
reverse
combine
normalize
countDim
diff
check
remove
classicExtract
matches
extract
format
enum
numeric
map
pushDiff
filter
merge
contains
Security
Cache
Cache::read()
Cache::write()
Cache::delete()
Cache::config()
Cache::set()
HttpSocket
get
post
request
Router
Core Console Applications
Code Generation with Bake
Bake improvements in 1.3
Schema management and migrations
Generating and using Schema files
Migrations with CakePHP schema shell
Modify default HTML produced by “baked” templates
Deployment
Tutorials & Examples
Blog
Getting Cake
Creating the Blog Database
Cake Database Configuration
Optional Configuration
A Note on mod_rewrite
Create a Post Model
Create a Posts Controller
Creating Post Views
Adding Posts
Data Validation
Deleting Posts
Editing Posts
Routes
Conclusion
Simple Acl controlled Application
Preparing our Application
Preparing to Add Auth
Initialize the Db Acl tables
Acts As a Requester
Creating ACOs (Access Control Objects)
An Automated tool for creating ACOs
Setting up permissions
Logging in
Logout
All done
Appendices
Migrating from CakePHP 1.2 to 1.3
Removed Constants
Configuration and application bootstrapping
File renames and internal changes
Controller & Components
Library Classes
Model Databases and Datasources
View and Helpers
Console and shells
Vendors, Test Suite & schema
Follow @CakePHP