1 / 15

Introduction to CodeIgniter

Introduction to CodeIgniter. Ian J Robotham Software Development Lead Medi-CAL Unit, University of Aberdeen. Who?. Ellis Labs Inc. Based in Bend, Oregon. What?. Open source Web Application Framework Lightweight Available for 5 years. Why?. Rapid Application Development

alaula
Download Presentation

Introduction to CodeIgniter

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to CodeIgniter Ian J Robotham Software Development Lead Medi-CAL Unit, University of Aberdeen

  2. Who? • Ellis Labs Inc. • Based in Bend, Oregon

  3. What? • Open source Web Application Framework • Lightweight • Available for 5 years

  4. Why? • Rapid Application Development • Noted for Speed • Handles much of the mundane – query processing, pagination, validation etc.

  5. MVC Controller View Model

  6. Getting Started • http://codeigniter.com/downloads/ • Download, extract & rename = “working” app • Configure & Code

  7. Security • URL • Anti register_globals • XSS Filtering • CSRF • Automatic GET/POST/COOKIE cleaning • Database escaping

  8. Active Record • Modified version of design pattern • Database independence* • Allows chaining (PHP5+) $query = $this->db->from(‘users’) ->where(‘dept’, ‘DIT’) ->order_by(‘lastnameasc’); foreach ($query->result() as $row) { echo $row->firstname.’ ‘.$row->lastname; }

  9. Form Validation • In controller • Some exists but can write own tests $this->load->library('form_validation'); $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); } else { $this->load->view('formsuccess'); }

  10. Libraries • Classes to add functionality • Write own (or use other external) • Extend native CI libraries • Replace native CI libraries • E.g. use to add TCPDF for PDF generation or ExcelWriter etc. • Can call elements of CI core

  11. Helpers • Collection of functions • Not OO • Independent • Can use in views, controller • Can call CI core if needed

  12. Inheritance • Useful in Controllers & Models • Create UOA_Model which each model extends • Handle simple CRUD calls • Create UOA_Controller which each controller extends • Handle common functions e.g. security checks etc.

  13. Sparks • Fairly new • http://getsparks.org/ • Repository of CI libraries (kind of) • API integrations e.g. Flickr, Google, Twitter • Payment integrations • Authentication & more • Don’t reinvent the wheel

  14. Other Options • Zend Framework • CakePHP • Symfony • Yii • http://www.phpframeworks.com/ • http://www.phpframeworks.com/top-10-php-frameworks/

  15. Questions? • i.robotham@abdn.ac.uk • 01224 437036 (UOA 7036) • @eyejaynet

More Related