Loading...
Flash Player 9 (or above) is needed to view slideshows. We have detected that you do not have it on your computer.To install it, go here
 
Post to Twitter Post to Twitter
Myspace Hi5 Friendster Xanga LiveJournal Facebook Blogger Tagged Typepad Freewebs BlackPlanet gigya icons
SlideShare is now available on LinkedIn. Add it to your LinkedIn profile.

Introduction To CodeIgniter

From schwebbie, 5 months ago Add as contact

Introduction to CodeIgniter presentation given at Refresh OKC on 17 Jun 2008.

965 views | 0 comments | 0 favorites | 23 downloads | 0 embeds (Stats)

Categories

Business & Mgmt

Groups/Events

Embed in your blog options close
Embed (wordpress.com) Exclude related slideshows Embed in your blog

More Info

This slideshow is Public
Total Views: 965 on Slideshare: 965 from embeds: 0
Flagged as inappropriate Flag as inappropriate

Flag as inappropriate

Select your reason for flagging this slideshow as inappropriate.

If needed, use the feedback form to let us know more details.

Slideshow Transcript

  1. Slide 1: Introduction to CodeIgniter Steve Webb Refresh OKC 17 Jun 2008
  2. Slide 2: What is CodeIgniter?  CodeIgniter is a lightweight web application framework written in PHP that adopts the model-view-controller approach to development
  3. Slide 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. Slide 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. Slide 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. Slide 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. Slide 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. Slide 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. Slide 9: Model  A class containing one or more related methods (custom PHP functions)  Typical uses: – Create – Read – Update – Delete
  10. Slide 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. Slide 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. Slide 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. Slide 13: Loader Class  Makes various resources available: – Databases – Views – Helpers – Plugins  $this->load->view(‘viewname’);
  14. Slide 14: URI Class  Provides access to specific parts of the URI string  Useful for building RESTful URIs  $this->uri->segment(n);
  15. Slide 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. Slide 16: Other Classes  Benchmarking  Language  Calendaring (internationalization)  Email  Output  Encryption  Pagination  File uploading  Session  FTP  Trackback  HTML Table  Unit testing  Image Manipulation  XML-RPC  Zip encoding
  17. Slide 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. Slide 18: My First CI Application 1. Unzip CI zip file into application folder on web server 2. [optional] For “pretty URLs”, add .htaccess file and enable mod_rewrite in Apache 3. Configure database in CI’s <config.php> 4. Write controller (or modify existing) 5. Write view (or modify existing) 6. Write model
  19. Slide 19: Demo