cake php

bake scaffolds


php cake/scripts/bake.php

bake command for scaffolding in CakePHP.


CakePHP Install Notes


CakePHP Notes

Just started installing CakePHP to play around with it. Took me a bit to get it to fly, but mostly it was just me doing silly things like copying files too fast and losing a required .htaccess here or there. Note that one crazy thing that kept me spinning for a bit was naming a test table 'objects'. Don't do that :-)

For the most part cake follows the same conventions as Rails. Noticed this difference:

  • Use 'created' and/or 'modified' as columns in tables to auto-fill. (rails uses 'created_at' 'created_by' etc.) Full docs are in the manual, and maybe there are more detailed options... worth checking out.

Install Notes on Mac

  • In a dev environment via localhost: set AllowOverride to All in httpd.conf for the directory out of which your serving Cake so that the .htaccess file gets picked up.

In database.php config file, set host to include the socket as well if you're running something like a macports install of mysql:

'host' => 'localhost:/opt/local/var/run/mysql5/mysqld.sock',

Or, you can also use 

and variations thereof.

  • Got a bit jiggy when I named a table 'objects' and played around with that. I'm guessing objects is a really bad test name for a table with CakePHP since there are probably some reserved controllers, models etc. called objects. Anyway, when I scaffolded up MVC off of a table called 'monkeys' instead, everything was happy.

  • To change the content of default home page, create: /app/views/pages/home.thtml.

  • To change default homepage layout, create: /app/views/layouts/default.thtml.

  • You can also add some CSS styles for your pages at: app/webroot/css/.


CakePHP References


A spot to list useful references as they come up:

the manual

the api

Templating practices