School of Computing and Information Systems CS 371 Web Application Programming CakePHP Server-side Framework
School of Computing and Information Systems CS 371 Web Application Programming Server-side Frameworks More than just a library Often they enforce a structured paradigm for better organization Remove some of the tedium of creating objects from database Rapid development
School of Computing and Information Systems CS 371 Web Application Programming CakePHP Enforces MVC architecture Based on PHP Similarities to Ruby-on-rails convention over configuration convention means naming conventions – ie stu, stuModel, stuController, view/stu, etc configuration means config files – lookup files to connect models to controllers, etc.
School of Computing and Information Systems CS 371 Web Application Programming Directory structure cake root app model controller View –app1 –app2 many other folders – only showing the main ones
School of Computing and Information Systems CS 371 Web Application Programming CakePHP Database drivers for mysql, oracle, postgres, etc. define database connection in a configuration file access to database is through model model def is very simple with common tasks built in think about writing an app to read a record from a table, delete a record, etc. now think about automating it
School of Computing and Information Systems CS 371 Web Application Programming Models you can create a model for each table override AppModel can also define relations hasOne – one to one hasMany – one to many belongsTo – many to one hasAndBelongsToMany
School of Computing and Information Systems CS 371 Web Application Programming Controller logic for user tasks, associated with a URL, e.g. define function for each task/url in the function define logic to connect the model data to the desired view use php and object provided by CakePHP d'oh
School of Computing and Information Systems CS 371 Web Application Programming View views are defined in ctp files in specific view directory (cakeRoot/app/view/myApp) use html, css, javascript, php forms for input/edit
School of Computing and Information Systems CS 371 Web Application Programming Set up (from tutorial) download to public_html and unzip it (rename it cake) create the database create cake/app/Config/database.php public $default = array( 'datasource' => 'Database/Mysql', 'persistent' => false, 'host' => 'cis.gvsu.edu', 'login' => 'yourMysqlLogin', 'password' => 'yourMysqlPassword', 'database' => 'yourLogin', 'prefix' => '', ); change the security strings in core.php make tmp web-writable