cakephp: an introduction
TRANSCRIPT
![Page 1: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/1.jpg)
CakePHP: An Introduction
Diana Jayne GonzalesWingcast Inc.
![Page 2: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/2.jpg)
What is CakePHP?
![Page 3: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/3.jpg)
Framework
Avoids re-inventing the wheel
![Page 4: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/4.jpg)
![Page 5: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/5.jpg)
Cake is for you if you want to...
do more things in less time
use a framework like RORstop creating the same codes
over and over again
templatingsearchable URLs
use MVC
use a framework that is suitable for all types of apps
![Page 6: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/6.jpg)
What Cake will do for you?
● eases creation of standard content management functionality (adding, editing and deleting)
● uses template-like Layouts and Views to separate logic from presentation
● validates form fields
● automatically escapes data saved to the database (to prevent SQL injection attacks)
● includes callbacks (eg. do an action before or after save)
● allows for both test and production databases
![Page 7: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/7.jpg)
Features
![Page 8: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/8.jpg)
PHP4 and 5 compatible
![Page 9: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/9.jpg)
Multiple DBs
![Page 10: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/10.jpg)
ORM - Object Record Mapper
DB Objects
![Page 11: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/11.jpg)
Validation
![Page 12: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/12.jpg)
Caching
![Page 13: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/13.jpg)
AJAX
![Page 14: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/14.jpg)
Auth Module - Access Lists
![Page 15: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/15.jpg)
Huge Code Base of Components and Plugins
![Page 16: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/16.jpg)
Resources● Taking A Look on 10 Different Frameworks (http://www.phpit.
net/article/ten-different-php-frameworks/)
● Cook Up Websites Fast with CakePHP (http://www.scribd.com/doc/5503/
CakePHP-tutorial-no-1-from-IBM)
● The CakePHP Framework: Your First Bite (http://www.sitepoint.com/article/
application-development-cakephp)
● CakePHP for Beginners: Tutorials (http://grahambird.co.uk/cake/tutorials/)
● CakePHP Manual(http://docs.huihoo.com/php/CakePHP-Manual/)
![Page 17: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/17.jpg)
Directory Structure● app/
○ config/○ controllers/○ models/○ plugins/○ tmp/○ vendors/○ views/○ webroot/
● cake/○ config/○ docs/○ libs/
● vendors/
![Page 18: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/18.jpg)
Installing CakePHP
![Page 19: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/19.jpg)
Get cake_1.1.17.5612.zip
![Page 20: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/20.jpg)
Unzip to /var/www/
![Page 21: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/21.jpg)
Rename folder to 'cake'
![Page 22: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/22.jpg)
define('ROOT', BASE_DIR.'/path_to_cake_ins
tall');define ('APP_DIR', 'app');define ('WEBROOT_DIR',
'/public_html');
to app/webroot/index.php
![Page 23: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/23.jpg)
Set up mod_rewrite
![Page 24: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/24.jpg)
Setup database on config/database.php
![Page 25: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/25.jpg)
Scaffolding
● analyzes your database tables
● creates standard lists with add, delete and edit buttons
● standard forms for editing and standard views for inspecting a single item in the database
![Page 26: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/26.jpg)
Exercise: Scaffolding a Bookmarks Manager
automated way of generating a view based on the model
![Page 27: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/27.jpg)
Exercise: Login
![Page 28: CakePHP: An Introduction](https://reader034.vdocument.in/reader034/viewer/2022042513/55546032b4c905a5798b48ce/html5/thumbnails/28.jpg)
Exercise: AJAX Task List