What is scaffolding?
Its something that you will find very useful in production apps. When you begin, you may want to throw up stuff real quick in order to get started. Ultimately, its a built in system for adding, editing, viewing and deleting your database records quickly.
Suppose we want to work with a table named users, and here is its SQL structure
`id` bigint(20) NOT NULL auto_increment,
`username` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
`email` varchar(96) NOT NULL,
`password` varchar(50) NOT NULL,
`updated` int(11) NOT NULL,
`created` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
Now lets create a model file first. It should be placed here: /app/models/user.php
class User extends AppModel
var $name = "User";
var $uses = "users" // table name
Create a controller file here: /app/controllers/users_controller.php
class UsersController extends AppController
var $name = 'Users';
Not required since the views for scaffolding are generated by CakePHP automatically.
Visit http://yoursite.com/users/ and start scaffolding.
Note: Always visit yoursite.com/controllerName/ to see the visual output of your controller.
I will show you a user registration and logging system in CakePHP soon.