Intro to Ushahidi for Developers
Upcoming SlideShare
Loading in...5
×
 

Intro to Ushahidi for Developers

on

  • 6,602 views

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.

Statistics

Views

Total Views
6,602
Views on SlideShare
6,316
Embed Views
286

Actions

Likes
7
Downloads
97
Comments
0

10 Embeds 286

http://www.readwriteweb.com 218
http://readwrite.com 34
http://www.seofacts.biz 19
http://webapps.my 6
https://www.readwriteweb.com 3
http://swik.net 2
http://www.netvibes.com 1
http://feeds2.feedburner.com 1
http://elsterama.com 1
http://www.webapps.my 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Intro to Ushahidi for Developers Intro to Ushahidi for Developers Presentation Transcript

  • Ushahidi 101
    • Setting up a development environment
    • Introduction to MVC and the Kohana (PHP) framework
    • Working with GIT
  • Setting up: Prerequisites
    MySQL
    PHP 5
    Apache
  • Setting up: Code
    Download and Install GIT (more later)
    http://git-scm.com/download
    Clone (‘Checkout’) the code
    cd [WORKING DIRECTORY]
    git clone git://github.com/ushahidi/Ushahidi_Web.git
    Fire up editor (e.g. Zend) and set up a new project from existing code
  • Setting up: Database
    Create a database in mysql called 'ushahidi'.
    Run USHAHIDI_ROOTsqlunshahidi.sql against DB
    Go to USHAHIDI_ROOTapplicationconfigdatabase.php and edit the user, database and host configurations.
  • 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)
  • 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.
  • Why use an MVC framework?
    Avoid “reinventing the wheel”
    Use proven, tested code
    Automation (ORM, generators)
    Maintainability
    “Plugin” functionality

  • Flow: Traditional vs. MVC
    Query
    Controller
    Model
    Processing
    Output
    Output
    Query
    Output
    Processing
    View
    Final Output
  • 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/ 
  • class Country_Modelextends ORM
    {
    protected $belongs_to= array('location');
    protected $has_many= array('city');
    // Database table name
    protected $table_name= 'country';
    }
    Example Model: Country
  • <div id="content">
    <div class="content-bg">
    <!-- start search block -->
    <div class="big-block">
    <h1>Search Results</h1>
    <div class="search_block">
    <?phpecho $search_info; ?>
    <?phpecho $search_results; ?>
    </div>
    </div>
    <!-- end search block -->
    </div>
    </div>
    </div>
    </div>
    </div>
    Example View: Search Results
  • Example Controller: Error 
    class Error_Controllerextends Controller
    {
    /**
    * Render Custom 404 Error Page
    */
    public function error_404()
    {
    Header("HTTP/1.0 404 Not Found");
    $this->layout = new View('error');
    $this->layout->title = Kohana::lang('ui_admin.page_not_found');
    $this->layout->content = Kohana::lang('ui_admin.page_not_found_message');
    $this->layout->render(true);
    }
    }
  • Working with GIT
    GIT is a version control system much like SVN
    The concepts are more or less the same - revisions, commits… 
    Ushahidi hosts source code repositories with GitHub - 
    http://github.com/ushahidi
    http://github.com/ushahidi/Ushahidi_Web
  • Basic commands
  • Learning Links
    GitHub Guide - http://github.com/guides
    Git Home - http://git.or.cz/
    http://github.com/guides/git-cheat-sheet
    Git - SVN Crash Course - http://git.or.cz/course/svn.html
    O'Reilly Webcast: Git in One Hour - http://www.youtube.com/watch?v=OFkgSjRnay4
  • More
    Developer guide: http://wiki.ushahidi.com/doku.php?id=developer