![](https://csdnimg.cn/release/download_crawler_static/10563820/bg14.jpg)
From Novice to Professional
This guide is for beginners to CakePHP. Whether or not you have much experience with the
PHP scripting language, working in Cake will require some new methods you may or may not
have tried before. If you don’t know what a “has-and-belongs-to-many” relationship is, don’t
know how to build your own class object, or don’t know how to parse an array, then this book
is a perfect place to start when getting into Cake.
Most of the available online resources require some sort of prior knowledge of web
development to get a grasp on how to install and work in Cake. If you’re like me when I
started using Cake, you probably just want a handful of tutorials with code samples from
square one that can get you up and running quickly and lead you in the right direction for
more advanced techniques. In fact, when asking a question on forums or chat rooms, many
beginners get little help or confusing leads from the experts. Simple questions can get a
response like “Well, just read the online manual and API.” Sometimes novices need a very
simple approach to the software, and this guide is just that. As you begin to master Cake, this
guide will also provide tips and a reference for helping you quickly add more features to your
projects and catch errors.
This book will start by showing how to install Cake on a server and your own computer
and will provide some detailed code samples and visual snapshots to walk you through the
process. In Chapter 2, I’ll show how to build a simple Cake application. You’ll get used to the
Model-View-Controller (MVC) structure and how to organize your Cake applications effec-
tively. In Part 2, you’ll build more extensive web applications in Cake, and you’ll explore Cake’s
built-in helpers, including the Ajax helper, and work with more advanced features. By the end
of the book, you will be able to create your own helpers, plugins, and other useful features that
will reduce the overall amount of code to run your applications, and you’ll also have a solid
enough foundation to try other advanced features on your own.
Why Cake?
Ever since Ruby on Rails became a popular web-based framework, teams of developers have
been creating clones of Rails or Rails-like frameworks for various languages: TurboGears for
Python; Zend, Symfony, and many others for PHP; Catalyst for Perl; and on and on. With so
many options out there, why choose CakePHP for your web project?
It’s PHP!
Many web developers complain about switching to Ruby on Rails simply because the frame-
work is built on the Ruby language. PHP, they say, is one of the more widely supported web
programming languages and is standard with most web services providers, so why give that
up for Ruby? For those who learned web development on PHP or those who have made PHP
their primary development tool, the idea of ditching PHP for something else may seem
daunting or time-consuming. For companies, switching to another language can require
reallocating resources, changing web service providers, or reworking an expensive server
configuration. Whatever the case, leaving PHP for another development framework can be
costly and time-consuming. With Cake, you can enjoy the benefits of framework-based
development without learning another language.
CHAPTER 1 ■ INTRODUCTION2