introduction to codeigniter
DESCRIPTION
Codeigniter slideshow at Chennai GeeksTRANSCRIPT
INTRODUCTION TO CODEIGNITERHarishankaran
Interviewstreet.com
WHY CI?
Small. Fast Simple Cleaner code
MVC
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);[…]}
}
CI – FILE STRUCTURE
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.
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.
CI - CONTROLLERS
class Welcome extends CI_Controller {
function index(){$this->load->view('welcome_message');}
} Business Logic, Validations
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'));
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);
AND LOTS MORE…
Calendar Shopping cart Email Encryption File Upload Image Manipulation Pagination XML-RPC
and many many more 3rd party libraries
TALK IS CHEAP. SHOW ME THE
CODE