Get Another 47-Page Chapter
The chapter “Cake 1.2 Functions and Properties” is now available for readers of Beginning CakePHP: From Novice to Professional. It contains 47 pages of reference material about the CakePHP framework which is useful for looking up functions and properties of the various classes. A preview is also available [PDF], if you’re interested in checking it out.
I’m thrilled about this chapter for a couple of reasons. First of all, I like cheatsheets, and this is like a cheatsheet for the whole CakePHP framework. Sure, for some things, the API is the only way to go for looking up specifics about functions and properties. But often, I just need to flip through a chart or a couple of pages to look up something, and having it right there in front of me is sometimes more accessible than bouncing back-and-forth between one tab on the API and another on my project or text editor.
Second, I’m thrilled about this chapter because it was not only fun to compile, but also has been useful for me as I’ve developed my own Cake apps. I’m excited to pass it along to you and make your life easier. There’s nothing worse than building something and then finding out that you could have accomplished the same method by calling out a one-line command from a Cake helper or component. This chapter will provide you with a concise view of what’s available in Cake and save you from this kind of disappointment.
So, dear reader, enjoy Appendix C: Cake 1.2 Functions and Properties and be sure to let me know if it has been beneficial for you. As always, I love hearing your feedback.
Comments
Aug 7th, 2008, 5:15 am
i rewrite it to
input('Comment.user_id');?>
input('Comment.name');?>
input('Comment.content');?>
input('Comment.post_id',array('type'=>'hidden','value'=> $post['Post']['id']));?>
submit('enter', array('div' => false,'class' => 'submitbutton', 'url' => array('controller'=> 'comments', 'action' => 'add'), 'update' => 'Kommentare', 'loading' => "$('loader').show()", 'loaded' => "$('loader').hide()")) ?>
Aug 7th, 2008, 10:31 am
@fokker
Listing 8-7 works fine in 1.2 and does follow the most basic method for using the Ajax::form() function, which is why I use it here; the book is designed to be instructional for beginners, and go from easy to more complex, so I don't have more verbose methods until later in the book.
Your first example is worth noting, though, and was implemented before I could get it into the text. I would rewrite it slightly to fit the context of the book:
form('add','post',array('model'=>'Comment','update'=>'comments'));
Book Review: Beginning CakePHP - cakebaker
Sep 21st, 2008, 8:11 am
[...] other (PHP) frameworks. A third appendix, “Cake 1.2 Functions and Properties”, can be downloaded from the author’s [...]
Nancy Milligan
Dec 10th, 2008, 5:14 pm
Actually, the listing in 8-7 no longer works as of Dec 2008. It says comments action missing from Post controller.
I've also tried
$ajax->form('/comments/add',
'post',array('model'=>'Comment','update'=>'comments'));
-- Same problem
And
$ajax->form('add',
'post',array('model'=>'Comment','update'=>'comments'));
Actually executes the add function in the posts controller.
I'm stuck. Any help would be appreciated.
Dec 11th, 2008, 1:02 am
I'm having the exact same problem as nancy...
form('add','post',array('model'=>'Comment','update'=>'comments'));
Executes the add function but does not enter into the database.
Thanks
Dec 11th, 2008, 1:13 am
Hi Nancy Milligan,
Was looking for the solution on this one as well
replace your code with the following:
$ajax->form('/comments/add','post',array('update'=>'comments','url'=>'/comments/add'));
Works great :).
Cool guy
Dec 11th, 2008, 3:44 am
am having the same problem as Nancy Milligan. When I run it, I get the following error:
Missing Method in CommentsController
Error: The action add is not defined in controller CommentsController
Error: Create CommentsController::add() in file: app/controllers/comments_controller.php.
Nancy Milligan
Dec 11th, 2008, 9:52 am
Woot! Thanks that fixed it. I'm going to post this on his forum so other folks have an easier time finding it.
Oct 22nd, 2009, 11:27 am
As Obama moved forward and placed his hand on the bible, it was apparent that his dreams became a reality. ,
Nov 9th, 2009, 7:26 pm
Hi! buy generic nolvadex http://www.stumbleupon.com/stumbler/med-brother/ buy nolvadex drug Happy birthday to you!
Good evening! buy online nolvadex buy cheap generic nolvadex online
buy nolvadex liquid Bye-bye!
Ron
Dec 30th, 2009, 8:39 pm
'Cake for Begineers' is an awesome book David. I've learned a lot from it. Thanks for the fantastic book. Also, I can bet with my friends to develop a starting web application in just 5 mins. ;)


fokker
Aug 7th, 2008, 3:33 am
Hi found Error in your Listing 8-7
in the first line the Ajax call Method call changed since 1.2
form('add','post',array('model'=>'Comment', 'update'=>'Kommentare'));?>
otherwise cool and long awaited book
laters
fokker