Title: Cake PHP
1Cake PHP
2What is Cake?
- Framework for PHP developers
- Free open source
- Model View Controller Architecture
3MVC Architecture
- Input - Processing - Output
- Controller - Model - View
4Steps
- Download CakePHP at cakephp.org
- Newest stable release vs. beta
5Server Requirements
- HTTP server, Apache
- PHP 4.3.2 or greater
- Database engine, mySQL
6XAMPP
- Apache mySql structure
- Gives you development freedom
- Fixed drive
- Flash device
7Testing
- http//127.0.0.1
- Put cake into folder
- Add table data to database
- Check data
8mySQL query browser
mysql-gui-tools-5.0-r12-win32
9Finally some CAKE?
- Your database configuration file is present.
- Cake is able to connect to the database.
- http//127.0.0.1/cake/
10Blog
Add post cake/posts/add Delete
cake/posts/delete Titles cake/posts/views/14
(uses id) as parameter
11Models
- It separates domain logic from the presentation,
isolating application logic.
'Post' var validate array(
'title' VALID_NOT_EMPTY, 'body'
VALID_NOT_EMPTY ) ?
Post by default works with the posts table in
the database
12Controllers
- Talk to one specific model
- PostsController contains functions of views.
class PostsController extends AppController
var name 'Posts' function index()
this-set('posts', this-Post-findAll()
)
13Views
Blog posts html-link('Add Post', '/posts/add')
? Id
Title Created
html-link(post'Post''title',
'/posts/view/'.post'Post''id')?
link(
'Delete', "/posts/delete/post'P
ost''id'", null,
'Are you sure?' )?
post'Post''created' ?
14Problems
- Mod_rewrite URL rewriter, uncomment
- Setting up passwords, login info
- Refresh issues
- Clear the cache
- Stop/start database
15References
- http//www.cakephp.org
- http//www.sourceforge.net/projects/xampp
- http//dev.mysql.com/downloads/gui-tools
-