Introduction To CodeIgniter

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Introduction To CodeIgniter - Presentation Transcript

    1. Introduction to CodeIgniter Steve Webb Refresh OKC 17 Jun 2008
    2. What is CodeIgniter?
      • CodeIgniter is a lightweight web application framework written in PHP that adopts the model-view-controller approach to development
    3. Why use a framework?
      • Web application frameworks provide basic building blocks needed by most applications
        • Database connections
        • Business logic
        • Form handling
      • Separation of concerns
      • Easier testing (unit tests)
    4. Why use CodeIgniter?
      • Feature rich
      • Lightweight
      • Open source
      • Well-supported by an active community
      • Excellent “by example” documentation
      • Easy to configure
      • Supports multiple databases
    5. Why use CodeIgniter?
      • In short, CodeIgniter is nice because it does what it needs to do and then gets out of the way.
    6. Model-View-Controller
      • Model – representation of the data
      • View – rendering of the data suitable for interaction with the user
      • Controller – the “traffic cop” that passes model data to the views and vice versa
      • This separation of concerns allows for greater flexibility, reuse of code, and overall preservation of the developer’s sanity
    7. Controller
      • A class containing one or more related methods (custom PHP functions)
      • Typical uses:
        • Request a set of data from the model by sending arguments
        • Send a payload of data to a view (web page)
        • Receive a data payload from a view
        • Apply business logic to make decisions
        • Pass data to the model for inclusion in a database
    8. View
      • Code that displays information to the user
      • Views can be:
        • Web pages with PHP code snippets inserted
        • Web pages with forms to gather user input
        • Other output (CSV, PDF, etc.)
    9. Model
      • A class containing one or more related methods (custom PHP functions)
      • Typical uses:
        • Create
        • Read
        • Update
        • Delete
    10. CodeIgniter Classes
      • CI’s built-in classes contain the basic functionality that are frequently used by web applications
      • The most-used classes are:
        • Database
        • Input
        • Loader
        • URI
        • Validation
    11. Database Class
      • Generates queries using the Active Record Pattern
      • Automatic escaping of input values
      • Provides method “chaining” for easy query building
      • $this->db->where(‘name’,$name);
    12. Input Class
      • Pre-processes user input (prevents common cross-site scripting techniques)
      • Provides access to user input and other data:
        • Form fields (POST)
        • Cookies
        • Server variables
      • $this->input->post(‘fieldname’);
    13. Loader Class
      • Makes various resources available:
        • Databases
        • Views
        • Helpers
        • Plugins
      • $this->load->view(‘viewname’);
    14. URI Class
      • Provides access to specific parts of the URI string
      • Useful for building RESTful URIs
      • $this->uri->segment(n);
    15. Validation Class
      • Helps validate user form input
        • Required fields
        • Required string formatting (length, regexp)
      • Enables success and failure messages on form submittal
      • Enables re-population of form fields after form submittal
    16. Other Classes
      • Benchmarking
      • Calendaring
      • Email
      • Encryption
      • File uploading
      • FTP
      • HTML Table
      • Image Manipulation
      • Language (internationalization)
      • Output
      • Pagination
      • Session
      • Trackback
      • Unit testing
      • XML-RPC
      • Zip encoding
    17. Helpers and Plugins
      • CodeIgniter comes with a wide array of “helper” functions that add convenience to applications and provide ease of reuse.
      • $this->load->helper(‘helper_name’);
      • CodeIgniter also allows for the use of custom add-on functions called “plugins”.
      • $this->load->plugin(‘plugin_name’);
    18. My First CI Application
      • Unzip CI zip file into application folder on web server
      • [optional] For “pretty URLs”, add .htaccess file and enable mod_rewrite in Apache
      • Configure database in CI’s <config.php>
      • Write controller (or modify existing)
      • Write view (or modify existing)
      • Write model
    19. Demo

    schwebbieschwebbie, 2 years ago

    custom

    2575 views, 0 favs, 0 embeds more stats

    Introduction to CodeIgniter presentation given at R more

    More Info

    © All Rights Reserved

    Go to text version
    • Total Views 2575
      • 2575 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 73
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as innappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel

    Categories