6. Setting up: Database Create a database in mysql called 'ushahidi'. Run USHAHIDI_ROOTqlnshahidi.sql against DB Go to USHAHIDI_ROOTpplicationonfigatabase.php and edit the user, database and host configurations.
7. What is MVC? Model-View-Controller Separates: M: Data model V: Presentation (UI) C: Business logic Can change any of these three without affecting the others (in theory)
8. What is MVC? A Model represents a data structure, usually this is a table in a database. A View contains presentation code such as HTML, CSS and JavaScript. A Controller contains the page logic to tie everything together and generate the page the user sees.
9. Why use an MVC framework? Avoid “reinventing the wheel” Use proven, tested code Automation (ORM, generators) Maintainability “Plugin” functionality …
10. Flow: Traditional vs. MVC Query Controller Model Processing Output Output Query Output Processing View Final Output
11. Kohana Kohana (http://kohanaframework.org/) is a PHP5 framework that uses the Model View Controller architectural pattern. It aims to be secure, lightweight, and easy to use. Documentation: http://docs.kohanaphp.com/ http://learn.kohanaphp.com/
12.
13.
14.
15. class Country_Modelextends ORM { protected $belongs_to= array('location'); protected $has_many= array('city'); // Database table name protected $table_name= 'country'; } Example Model: Country