David Golding



Table of Contents

By David Golding

I’ve been asked about my upcoming CakePHP book’s table of contents. Here’s a list of the chapters with a short description about each one. As always, you can order the book which is now available online and at a bookstore near you.

Chapter 1: Introduction

Discusses many of the main advantages for using Cake and explains the direction I will go in teaching you how to use it. Briefly explains the model-view-controller (MVC) paradigm for software development as well as the concept of inversion of control for frameworks. Key benefits of using Cake over other frameworks are also discussed.

Chapter 2: Installing and Running CakePHP

This chapter explains how to install Cake and launch a bare-bones application in your web browser. This book uses CakePHP 1.2 RC1, so the installation procedures get you running in 1.2 quickly. More detailed instructions for running Cake on a localhost setup are explained in Appendix A.

Chapter 3: Creating a To-Do List Application

All about using Cake’s scaffolding feature to create a to-do list application. Explains in more detail how MVC works in Cake.

Chapter 4: Naming Files and Designing the Database

Explains the naming conventions in Cake, best practices when naming files and resources, and how to set up the database to work with Cake. Discusses database normalization, as well as Cake’s table association parameters that manage one-to-one, one-to-many, and many-to-many data relationships. How to use models is discussed, and each of Cake’s table association methods (belongsTo, hasOne, hasMany, and hasAndBelongsToMany) are explained in detail.

Chapter 5: Creating Simple Views and Baking in the Console

Explains various methods for creating views and layouts and how to use the Bake shell script to create views and functions automatically. Gives instructions on how to get Bake working in the console as well.

Chapter 6: Customizing Views

Discusses different user interaction sequences in Cake, how to handle form submissions, and how to customize views following previously baked code.

Chapter 7: Working with Controllers and Models

The main tutorial of building a more extensive blog application begins in this chapter. Explains how to customize controllers and models to handle various methods. Model functions, like find() and read(), as well as data validation methods are explained in detail. How to build controller actions is also discussed.

Chapter 8: Implementing Ajax Features

All about the Ajax helper and how to use Ajax in Cake to building a voting mechanism into the blog’s comments section. Also explains how to do file uploads using the File utility class and jQuery.

Chapter 9: Helpers

This chapter goes into detail about using helpers, how to build custom helpers, and what’s available in Cake’s built-in helpers. Each function in the HTML and Form helpers is discussed, and all other built-in helpers are outlined as well.

Chapter 10: Routes

Building routes with arguments, reverse routing, custom expressions, magic variables, and more is explained here. Also explains how to parse files with extensions other than .php and how to dynamically render an RSS feed in Cake, with a .rss extension in the URL.

Chapter 11: Components and Utilities

Explains how to use components in Cake and discusses some built-in components. The Auth, Session, Cookie, and Email components are explained in more detail, and the ACL, RequestHandler, and Security components are outlined. Cake’s utility classes, like Configure, File, Folder, HTTP Socket are explained as well as how to use I18n and L10n classes in your application.

Chapter 12: Vendors

About how to use third-party scripts in your Cake app. Also how to use Zend Framework in Cake; the Akismet and PDF Zend components are specifically mentioned and built into the blog tutorial application.

Chapter 13: Plugins

About creating Cake plugins. This chapter explains how to build a calendar plugin for use in the blog.

Chapter 14: DataSources and Behaviors

Explains how to build custom DataSources and gives a walkthrough for building an XML DataSource. Also explains building behaviors, and gives a detailed walkthrough of the Tree and Containable behaviors. Outlines other built-in behaviors and explains how to build a custom behavior.

Chapter 15: Wrapping Up the Application

Discusses the final routines when completing a Cake project, like building landing pages, using the Pages controller, generating dynamic navigation, customizing the overall design, debugging the application, and running a Cake app on a remote host.

Appendix A: Installation Issues

Explains how to set up a localhost to run Cake on a Mac and PC, and how to run MySQL.

Appendix B: How CakePHP Compares with Other Frameworks

Compares Cake with other PHP frameworks: Zend Framework, CodeIgniter, and Symfony. Discusses why Cake is better :)


Comments

11 Responses to “Table of Contents”

Martin Bavio

Jul 9th, 2008, 11:53 am

Wow, seems like a really nice book! I cant wait to have it in my eyes!
Question: are u planing to release a PDF version? That would be cool for me...

David Golding

Jul 9th, 2008, 12:02 pm

As I understand, an e-book version will be available from Apress when the book publishes. Check out the product page at:

http://apress.com/book/view/9781430209775

Jeremy

Jul 9th, 2008, 2:09 pm

Got the book preordered from Amazon, can't wait!

depi

Aug 2nd, 2008, 2:31 am

Hello David, yesterday I received your book. I scanned the content, it looks interesting, however I can't see there anything about caching, maybe I just don't find it, but if it is not there it is pity as caching is also very important in today web applications.

David Golding

Aug 2nd, 2008, 10:14 am

@depi

You're right, caching is important for more complex web apps. I didn't include caching in the book for a couple of reasons. First, I had to make sure all of my examples conformed to version 1.2 RC1, and I noticed some important changes to caching methods between releases. I couldn't confirm that the current state of caching in RC1 was permanent, so I would have risked the integrity of the book by including it, which I'm not totally averse to doing, but it wasn't the same as, say, how to build layouts.

Second, I was nervous about losing my audience by delving into highly technical methods. You'll notice that I gloss over ACL in the book; I wasn't about to write a "definitive" explanation of ACL methods when I can find no absolute consensus over the right protocol for using the ACL component and managing permissions. And I feared that giving my own explanation could potentially take the book from introducing Cake to beginners and novices to only making sense to advanced readers. In a lesser sense, but certainly in some measure, I had similar concerns about caching, though admittedly, caching is much less complex than ACL.

Third, and the factor that most influenced my decision to not include caching tutorials, was time. From the start, I had limited time in completing the manuscript and, frankly, felt frantic during most of the draft period. The one thing I would not compromise, as much as possible, was the quality of the text, and so I trimmed the fat, so to speak, on exactly what was essential for someone learning Cake to know, and what was ancillary. I decided that caching fit in there with shell scripting (which Cake also does marvelously well), and other useful, important, and advanced features that wasn't absolutely essential to a new Cake developer's knowledge. In other words, I couldn't justify leaving out DataSources, especially since so little is written online about them, nor Behaviors, though these are some of the more technical tutorials in the book, and other Cake classes, so they're in there.

Please forgive me if you still feel that I let you down... I'll certainly remember your feedback if (when?) I begin work on a second edition.

depi

Aug 4th, 2008, 7:16 am

Thank you for you reply David.

I fully understand you, however maybe you could write at least some bonus articles here on the blog, or make a bonus PDF for first edition owners, I think it could be interesting this way too.

But now I will look around on the web to find some information about this topic.

Anyway thanks for your book!

mark

Aug 10th, 2008, 3:04 pm

i would really apprechiate it too.
got the book 1 week ago, and it helped me a lot lately.
right now i am testing the xml datasource - and hopefully i can combine it with some caching. so if there will be a bonus article on it, that would be great :)

mark

Aug 10th, 2008, 4:09 pm

actually i did find two little errors/problems a few minutes before.

Listing 14-6 (Page 250)

DS seperator to work on windows systems and just a copy&paste thing:

... .'files'.DS. ...

Line 19 [about ...->read();]

$file should here be $this->FileUtil
(has been $file in the File Example Before on Page 199ff)

/**
* Connect to datasource
* @return boolean Success
*/
function connect() {
App::import('Core','File');
$this->FileUtil =& new File(WWW_ROOT.'files'.DS.$this->config['file']);
$this->File = $this->FileUtil->read();

if (!$this->File) {
return false;
}
return true;
}

mark

Aug 14th, 2008, 1:38 pm

PS: i did also find out, that the "minimal configuration of a new datasource (in this case "xml_source.php")
does need ANOTHER function in order to work properly with form fields
(submit a form in a controller action that does access the xmlsource will cause the following error otherwise:

Fatal error: Call to undefined method XmlSource::boolean() in G:\xampp\htdocs\c\cake\libs\view\helpers\form.php on line 815

so this is needed:

/**
* Translates between PHP boolean values and Database (faked) boolean values
*
* @param mixed $data Value to be translated
* @return mixed Converted boolean value
*/
function boolean($data) {
if ($data = true || $data = false) {
if ($data === true) {
return 1;
}
return 0;
} else {
return !empty($data);
}
}

David Golding

Aug 14th, 2008, 9:16 pm

@mark

Thanks! Great help with this function. Writing about DataSources was perhaps the most challenging because so little has been documented about them, so I very much appreciate your catching this error and fixing it, as well as forwarding it along.

mark

Aug 15th, 2008, 5:28 am

well.. but i ran into some more problems..
the datasouce does not get along well with the security component (i had to deactivate it on sites i use the xml source).
And - especially in the web (on localhost it seemed to work) - i get the "white screen of death" on any site which uses the xml datasource.
i think it is the datasource itself..
although i dont know if i started and ended it the right way:

MODEL:
function xmlRead() {
$this->setDataSource('xml');
$xml= $this->getDataSource();
$xml->connect('4.txt');
$content = $xml->findAll();
$xml->close();
return $content;
}

function xmlWrite($content) {
$this->setDataSource('xml');
$xml= $this->getDataSource();
$xml->connect('4.txt');

$content = $xml->writeToXml($content);
$xml->close();
return $content;
}

i dont understand it anyway - how it is possible not to surpress these "white screens" - as this makes it really hard to debug it.

anyway - if i take the xml-> part out of these 2 functions, the site is displayed again.
and the rights are on 0777 - so this cant be the problem either.. maybe even some cake bug.
well, i ended up writing and reading xml files through a component.

feel free to drop me a line if you are interested in some more details.
mark



Submit Comment


Beginning CakePHP: From Novice to Professional by David Golding

David Golding

A blog about CakePHP, web design, and grad studies in religion. © 2008, D. Golding