Friday, September 14, 2007

Scaffolding and Decorating your web app with CakePHP

(Shunro Dozono / http://www.cba-japan.com )

(1)You can download 'decorate.php' from
http://cakephp.jp/decorate.zip
http://cakeforge.org/projects/decorate/
copy it to cake/scripts

copy_it_to_scripts_folder.PNG


(2)Set your DB-table

set_your_database_table.PNG

(3)Start baking [decorating] by using Windows Command Prompt.

prompt> your_php_path\php.exe path\decorate.php

start_decorate_script.PNG

(4)Script will bake all the files for you.

baked(decorated)files.PNG

(5)Goto http://localhost/cake/TABLENAME

baked_application.PNG

(6)CRUD (Create, Read, Update, Delete) features

crud(create).PNG

(7)CakePHP can handle "table associations"!

table_associations.PNG

(8)Complex Sorting feature

sorting.PNG


(9)Filtering(Search) feature

search_filtering.PNG

(10)You can make your own "template" design files. or you can download from
http://cakephp.seesaa.net/article/20355864.html

If you just drop your template file to "layout", it will be...
templates.PNG

(11)If you want "login" feature, CakePHP has already various types of authentification.

http://manual.cakephp.org/appendix/simple_user_auth

or if you just need only one username and password, you can download sd_auth from
http://cakeforge.org/snippet/detail.php?type=package&id=20

just "drop" the sd_auth file to app/controllers/components, and thtml desing file to app/view/layouts/. then,

Add following lines to app_controller.php(Copy from /cake to /app).

class AppController extends Controller {

var $components = array('SdAuth');

function beforeFilter()
{
// Auth Check.
if($this->SdAuth->isloggedin() == FALSE){
$this->layout = "login";
} else {
$this->layout = "default";
};
}

}


login.PNG

No comments:

About Me

Ordinary People that spend much time in the box
Powered By Blogger