CakePHP is a nice way of using MVC architecture in you PHP environment. Looking through this presentation you'll get introduced to MVC and get some start up code examples for you to explore.
24. Use Bake The CakePHP Bake console can create any of CakePHP’s basic ingredients: models, views and controllers. And I am not just talking skeleton classes: Bake can create a fully functional application in just a few minutes.
25. Use Bake In order to use the bakery, locate the cake bash script in your path and make it executable (make sure you have access rights to the path, using sudo -i or equivalent): $ cp cake/console/cake* /usr/local/bin/$ mv cake /usr/cake$ chmod 755 /usr/local/bin/cake Using the Bakery $ cake –help [..] acl [CORE] i18n [CORE] api [CORE] schema [CORE] bake [CORE] testsuite [CORE] console [CORE]
26. Let us create the tables for our application which will be a jobs board: CREATE TABLEIF NOT EXISTS `categories` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM;CREATE TABLEIF NOT EXISTS `jobs` (`id` int(11) NOT NULL AUTO_INCREMENT,`category_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,`title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,`body` text COLLATE utf8_unicode_ci,`company` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,`job_type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,`created` datetime DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM;CREATE TABLEIF NOT EXISTS `users` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(255) COLLATE utf8_unicode_ci NOT NULL,`pass` varchar(255) COLLATE utf8_unicode_ci NOT NULL,`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,`location` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,`address` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,`email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,`web` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM;
27. Enter this code in your command prompt $ cd /var/www/newcakeapp$ cake bake all[..](Press) 1 (for categories) Bake generated the links for List jobs and New job, but it is not working at this moment as we did not bake files for jobs table yet. Repeat cake bake all as necessary. Now, point your browser to your categories controller. Go ahead and try to add an empty category. Validation is working, but messages need some tweaking. Notice how CakePHP added a Pagination below the table with Categories. Nice. And if you click on column names, data is sorted by that column!