Your SlideShare is downloading. ×
0
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Intro to Ushahidi for Developers
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Intro to Ushahidi for Developers

5,452

Published on

Intro to Ushahidi for developers. Prepared by Wilfred Mworia and Linda Kamau - Ushahidi Devs.

Intro to Ushahidi for developers. Prepared by Wilfred Mworia and Linda Kamau - Ushahidi Devs.

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,452
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
117
Comments
0
Likes
8
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Ushahidi 101<br /><ul><li>Setting up a development environment
  • 2. Introduction to MVC and the Kohana (PHP) framework
  • 3. Working with GIT</li></li></ul><li>Setting up: Prerequisites<br />MySQL<br />PHP 5<br />Apache<br />
  • 4. Setting up: Code<br />Download and Install GIT (more later)<br />http://git-scm.com/download<br />Clone (‘Checkout’) the code<br />cd [WORKING DIRECTORY]<br />git clone git://github.com/ushahidi/Ushahidi_Web.git<br />Fire up editor (e.g. Zend) and set up a new project from existing code<br />
  • 5.
  • 6. Setting up: Database<br />Create a database in mysql called 'ushahidi'.<br />Run USHAHIDI_ROOTsqlunshahidi.sql against DB<br />Go to USHAHIDI_ROOTapplicationconfigdatabase.php and edit the user, database and host configurations.<br />
  • 7. What is MVC?<br />Model-View-Controller<br />Separates:<br />M: Data model<br />V: Presentation (UI)<br />C: Business logic<br />Can change any of these three without affecting the others (in theory)<br />
  • 8. What is MVC?<br />A Model represents a data structure, usually this is a table in a database.<br />A View contains presentation code such as HTML, CSS and JavaScript.<br />A Controller contains the page logic to tie everything together and generate the page the user sees.<br />
  • 9. Why use an MVC framework?<br />Avoid “reinventing the wheel”<br />Use proven, tested code<br />Automation (ORM, generators)<br />Maintainability<br />“Plugin” functionality<br />…<br />
  • 10. Flow: Traditional vs. MVC<br />Query<br />Controller<br />Model<br />Processing<br />Output<br />Output<br />Query<br />Output<br />Processing<br />View<br />Final Output<br />
  • 11. Kohana<br />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.<br />Documentation: http://docs.kohanaphp.com/ <br />http://learn.kohanaphp.com/ <br />
  • 12.
  • 13.
  • 14.
  • 15. class Country_Modelextends ORM<br />{<br />protected $belongs_to= array('location');<br />protected $has_many= array('city');<br />// Database table name<br />protected $table_name= 'country';<br />}<br />Example Model: Country<br />
  • 16. <div id="content"><br /><div class="content-bg"><br /><!-- start search block --><br /><div class="big-block"><br /><h1>Search Results</h1><br /><div class="search_block"><br /><?phpecho $search_info; ?><br /><?phpecho $search_results; ?><br /></div><br /></div><br /><!-- end search block --><br /></div><br /></div><br /></div><br /></div><br /></div><br />Example View: Search Results<br />
  • 17. Example Controller: Error <br />class Error_Controllerextends Controller<br />{<br />/**<br /> * Render Custom 404 Error Page<br /> */<br />public function error_404()<br />{<br />Header("HTTP/1.0 404 Not Found");<br />$this->layout = new View('error');<br />$this->layout->title = Kohana::lang('ui_admin.page_not_found');<br />$this->layout->content = Kohana::lang('ui_admin.page_not_found_message');<br />$this->layout->render(true);<br />}<br />}<br />
  • 18. Working with GIT<br />GIT is a version control system much like SVN<br />The concepts are more or less the same - revisions, commits… <br />Ushahidi hosts source code repositories with GitHub - <br />http://github.com/ushahidi<br />http://github.com/ushahidi/Ushahidi_Web<br />
  • 19. Basic commands<br />
  • 20. Learning Links<br />GitHub Guide - http://github.com/guides<br />Git Home - http://git.or.cz/<br />http://github.com/guides/git-cheat-sheet<br />Git - SVN Crash Course - http://git.or.cz/course/svn.html<br />O'Reilly Webcast: Git in One Hour - http://www.youtube.com/watch?v=OFkgSjRnay4<br />
  • 21. More<br />Developer guide: http://wiki.ushahidi.com/doku.php?id=developer<br />

×