introduction to codeigniter

12
INTRODUCTION TO CODEIGNITER Harishankaran Interviewstreet.com

Upload: harishankaran-k

Post on 09-Dec-2014

2.009 views

Category:

Technology


3 download

DESCRIPTION

Codeigniter slideshow at Chennai Geeks

TRANSCRIPT

Page 1: Introduction to codeigniter

INTRODUCTION TO CODEIGNITERHarishankaran

Interviewstreet.com

Page 2: Introduction to codeigniter

WHY CI?

Small. Fast Simple Cleaner code

Page 3: Introduction to codeigniter

MVC

Page 4: Introduction to codeigniter

URL STRUCTURE

http://example.com/controller_class/method/data

<?phpclass Search extends CI_Controller {[…]function retrieve($id) {[…]$id2 = $this->uri->segment(3);assert($id = $id2);[…]}

}

Page 5: Introduction to codeigniter

CI – FILE STRUCTURE

Page 6: Introduction to codeigniter

CI – MODELS

<?phpclass User_Model extends CI_Model {[…]function getAllActiveUsers($id) {[…]$this->db->from(‘users’);$this->db->where(‘active’, ‘true’);return $this->db->get()->result();}

} CRUD operations on database.

Page 7: Introduction to codeigniter

CI - VIEWS

<body><h1>Welcome to CodeIgniter!</h1><p>The page you are looking at is being generated dynamically by CodeIgniter.</p>

</body>

HTML content, output to browser.

Page 8: Introduction to codeigniter

CI - CONTROLLERS

class Welcome extends CI_Controller {

function index(){$this->load->view('welcome_message');}

} Business Logic, Validations

Page 9: Introduction to codeigniter

CI – TWITTER LIBRARY

Fetch public timeline<?php$this->load->library('twitter');$this->twitter->call('get', 'users/show', array('screen_name' => ‘interviewstreet'));

?>

Search

$this->twitter->search(array('q' => ‘helloworld'));

Page 10: Introduction to codeigniter

CI – ASKIMET LIBRARY

$this->load->library('akismet');$comment = array('comment_author' => ‘Harishankaran','comment_author_email' => ‘[email protected]',

'comment_content' => 'So, can you check if this comment is a spam.'

);

$status = $this->akismet->check($comment);

Page 11: Introduction to codeigniter

AND LOTS MORE…

Calendar Shopping cart Email Encryption File Upload Image Manipulation Pagination XML-RPC

and many many more 3rd party libraries

Page 12: Introduction to codeigniter

TALK IS CHEAP. SHOW ME THE

CODE