 | Level: Intermediate Duane O'Brien, PHP developer, Freelance
12 Dec 2006 Updated 02 Jun 2009 CakePHP is a stable production-ready, rapid-development aid for
building Web sites in PHP. This
"Cook
up Web sites fast with CakePHP"
series shows you how to build an online product catalog using
CakePHP. Part 2 demonstrates how to use scaffolding and Bake to get a jumpstart on your application, and using CakePHP's access control lists (ACLs).
Before you start
Editor's note: This series was originally published in 2006, and updated in 2007 and
2008. Since its last publication, CakePHP developers made changes to
CakePHP resulting in multiple revisions of this series. This revision
was written for CakePHP V1.2.2.8120.
This "Cook up Web sites fast with CakePHP"
series is designed for PHP application developers who want to
start using CakePHP to make their lives easier. In the end, you will
have learned how to install and configure CakePHP, the basics of
Model-View-Controller (MVC) design, how to validate user data in
CakePHP, how to use CakePHP helpers, and how to get an application up
and running quickly using CakePHP. It might sound like a lot to learn,
but don't worry — CakePHP does most of it for you.
About this series
-
Part 1
focuses on getting CakePHP up and running, and the basics of how
to put together a simple application allowing users to register
for an account and log in to the application.
- Part 2 demonstrates how to use scaffolding and Bake to get a
jump-start on your application, and using CakePHP's access-control
lists (ACLs).
-
Part 3
shows how to use Sanitize, a handy CakePHP class, which helps
secure an application by cleaning up user-submitted data. Part 3
also covers the CakePHP security component, handling invalid
requests and other advanced request authentication.
-
Part 4
focuses primarily on the Session component of CakePHP,
demonstrating three ways to save session data, as well as the
Request Handler component to help you manage multiple types of
requests (mobile browsers, requests containing XML or HTML,
etc).
-
Part 5
deals with caching, specifically view and layout caching, which
can help reduce server resource consumption and speed up your
application.
About this tutorial
This tutorial shows you how to jump-start your CakePHP application
using scaffolding and Bake. You will also learn the ins and outs of
using CakePHP's ACLs. You'll get a look at what scaffolding is and
what it provides. Then you'll learn how to use Bake to generate the
code for a scaffold, letting you tweak it as you go. Finally, you will
learn about ACLs: what they are, how to create them, and how to use
them in your application. This tutorial builds on the online product
application Tor, created in
Part 1.
Prerequisites
It is assumed that you are familiar with PHP,
have a fundamental grasp of database design, and are comfortable
getting your hands dirty. A full grasp of the MVC design pattern is
not necessary, as the fundamentals will be covered during this
tutorial. More than anything, you should be eager to learn, ready to
jump in, and anxious to speed up your development time.
System requirements
Before you begin, you need to have an environment in which you can
work. CakePHP has reasonably minimal server requirements:
- An HTTP server that supports sessions (and preferably
mod_rewrite). This tutorial was written
using Apache V2.2.4 with mod_rewrite
enabled.
- PHP V4.3.2 or later (including PHP V5). This tutorial was written
using PHP V2.3.
- A supported database engine. This tutorial was written using MySQL
V5.0.4.
You'll also need a database ready for your application to use. The
tutorial will provide syntax for creating any necessary tables in
MySQL.
The simplest way to download CakePHP is to visit
CakeForge.org and
download the latest stable version. This tutorial was written using
V1.2.2.8120. Nightly builds and copies straight from Subversion are
also available. Details are in the CakePHP Manual (see
Resources).
|  |