Introduction to codeigniter

2,270 views

Published on

Codeigniter slideshow at Chennai Geeks

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

  • Be the first to like this

No Downloads
Views
Total views
2,270
On SlideShare
0
From Embeds
0
Number of Embeds
165
Actions
Shares
0
Downloads
51
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Introduction to codeigniter

  1. 1. Introduction to Codeigniter<br />Harishankaran<br />Interviewstreet.com<br />
  2. 2. WHY CI?<br />Small.<br />Fast<br />Simple<br />Cleaner code<br />
  3. 3. MVC<br />
  4. 4. URL Structure<br />http://example.com/controller_class/method/data<br /><?php<br />class Search extends CI_Controller {<br />[…]<br /> function retrieve($id) {<br /> […]<br /> $id2 = $this->uri->segment(3);<br /> assert($id = $id2);<br /> […]<br /> }<br />}<br />
  5. 5. CI – File structure<br />
  6. 6. CI – Models<br /><?php<br />class User_Model extends CI_Model {<br />[…]<br /> function getAllActiveUsers($id) {<br /> […]<br /> $this->db->from(‘users’);<br /> $this->db->where(‘active’, ‘true’);<br /> return $this->db->get()->result();<br /> }<br />}<br />CRUD operations on database.<br />
  7. 7. CI - Views<br /><body><br /><h1>Welcome to CodeIgniter!</h1><br /><p>The page you are looking at is being generated dynamically by CodeIgniter.</p><br /></body><br />HTML content, output to browser.<br />
  8. 8. CI - Controllers<br />class Welcome extends CI_Controller {<br /> function index()<br /> {<br /> $this->load->view('welcome_message');<br /> }<br />}<br />Business Logic, Validations<br />
  9. 9. CI – Twitter Library<br />Fetch public timeline<br /><?php<br />$this->load->library('twitter');<br />$this->twitter->call('get', 'users/show', array('screen_name' => ‘interviewstreet'));<br />?><br />Search<br />$this->twitter->search(array('q' => ‘helloworld'));<br />
  10. 10. CI – Askimet Library<br />$this->load->library('akismet');<br />$comment =array(<br />'comment_author' => ‘Harishankaran',<br />'comment_author_email' => ‘hari@interviewstreet.com',<br />'comment_content' => 'So, can you check if this comment is a spam.'<br />);<br />$status = $this->akismet->check($comment);<br />
  11. 11. And lots more…<br />Calendar<br />Shopping cart<br />Email<br />Encryption<br />File Upload<br />Image Manipulation<br />Pagination<br />XML-RPC<br />and many many more 3rd party libraries<br />
  12. 12. TALK IS CHEAP. SHOW ME THE <br />CODE<br />

×