SlideShare a Scribd company logo
Submitted By 
Reshma vijayan .R
 Introduction 
 Why Framework not Scratch? 
 MVC ( Model View Controller) Architecture 
 What is CodeIgniter ???? 
 Application Flow of CodeIgniter 
 CodeIgniter URL 
 Controllers 
 Views 
 Models 
 CRUD operations 
 Session starting 
 Form validation 
 Q/A 
 Reference
 Key Factors of a Development 
 Interface Design 
 Business Logic 
 Database Manipulation 
 Advantage of Framework 
 Provide Solutions to Common problems 
 Abstract Levels of functionality 
 Make Rapid Development Easier 
 Disadvantage of Scratch Development 
 Make your own Abstract Layer 
 Solve Common Problems Yourself 
 The more Typing Speed the more faster
 Separates User Interface From Business Logic 
 Model - Encapsulates core application data and functionality Business 
Logic. 
 View - obtains data from the model and presents it to the user. 
 Controller - receives and translates input to requests on the model or the 
view 
Figure : 01
 An Open Source Web Application Framework 
 Nearly Zero Configuration 
 MVC ( Model View Controller ) Architecture 
 Multiple DB (Database) support 
 Caching 
 Modules 
 Validation 
 Rich Sets of Libraries for Commonly Needed Tasks 
 Has a Clear, Thorough documentation
Figure : 2 [ Application Flow of CodeIgniter]
URL in CodeIgniter is Segment Based. 
www.your-site.com/news/article/my_article 
Segments in a URI 
www.your-site.com/class/function/ID 
CodeIgniter Optionally Supports Query String URL 
www.your-site.com/index.php?c=news&m=article&ID=345
A Class file resides under “application/controllers” 
www.your-site.com/index.php/first 
<?php 
class First extends CI_Controller{ 
function First() { 
parent::Controller(); 
} 
function index() { 
echo “<h1> Hello CUET !! </h1> “; 
} 
} 
?> 
// Output Will be “Hello CUET!!” 
• Note: 
• Class names must start with an Uppercase Letter. 
• In case of “constructor” you must use “parent::Controller();”
In This Particular Code 
www.your-site.com/index.php/first/bdosdn/world 
<?php 
class First extends Controller{ 
function index() { 
echo “<h1> Hello CUET !! </h1> “; 
} 
function bdosdn( $location ) { 
echo “<h2> Hello $location !! </h2>”; 
} 
} 
?> 
// Output Will be “Hello world !!” 
• Note: 
• The ‘Index’ Function always loads by default. Unless there is a second 
segment in the URL
 A Webpage or A page Fragment 
 Should be placed under “application/views” 
 Never Called Directly 
10 
web_root/myci/system/application/views/myview.php 
<html> 
<title> My First CodeIgniter Project</title> 
<body> 
<h1> Welcome ALL … To My .. ::: First Project ::: . 
. . </h1> 
</body> 
</html>
Calling a VIEW from Controller 
$this->load->view(‘myview’); 
Data Passing to a VIEW from Controller 
function index() { 
$var = array( 
‘full_name’ => ‘Amzad Hossain’, 
‘email’ => ‘tohi1000@yahoo.com’ 
); 
$this->load->view(‘myview’, $var); 
} 
<html> 
<title> ..::Personal Info::.. </title> 
<body> 
Full Name : <?php echo $full_name;?> <br /> 
E-mail : <?=email;?> <br /> 
</body> 
</html>
Designed to work with Information of Database 
Models Should be placed Under “application/models/” 
<?php 
class Mymodel extend Model{ 
function Mymodel() { 
parent::Model(); 
} 
function get_info() { 
$query = $this->db->get(‘name’, 10); 
/*Using ActiveRecord*/ 
return $query->result(); 
} 
} 
?> 
Loading a Model inside a Controller 
$this->load->model(‘mymodel’); 
$data = $this->mymodel->get_info();
CRUD OPERATIONS IN MVC 
➢Create 
➢Read 
➢Update 
➢Delete
DATABASE CREATION 
//Create 
CREATE TABLE `user` ( 
`id` INT( 50 ) NOT NULL AUTO_INCREMENT 
, 
`username` VARCHAR( 50 ) NOT NULL , 
`email` VARCHAR( 100 ) NOT NULL , 
`password` VARCHAR( 255 ) NOT NULL , 
PRIMARY KEY ( `id` ) 
)
DATABASE CONFIGURATION 
Open application/config/database.php 
$config['hostname'] = "localhost"; 
$config['username'] = "root"; 
$config['password'] = ""; 
$config['database'] = "mydatabase"; 
$config['dbdriver'] = "mysql";
CONFIGURATION 
Then open application/config/config.php 
$config['base_url'] = 'http://localhost/ci_user'; 
Open application/config/autoload.php 
$autoload['libraries'] = array('session','database'); 
$autoload['helper'] = array('url','form'); 
Open application/config/routes.php, change 
default controller to user controller
Creating our view page 
Create a blank document in the views file (application -> 
views) and name it Registration.php /Login.php 
Using HTML and CSS create a simple registration 
form
public function add_user() 
{ 
$data=array 
( 
'FirstName' => $this->input- 
>post('firstname'), 
'LastName'=>$this->input- 
>post('lastname'), 
'Gender'=>$this->input->post('gender'), 
'UserName'=>$this->input- 
>post('username'), 
'EmailId'=>$this->input->post('email'), 
'Password'=>$this->input- 
>post('password')); 
$this->db->insert('user',$data); 
}
//select 
public function doLogin($username, $password) 
{ 
$q = "SELECT * FROM representative WHERE 
UserName= '$username' AND Password = 
'$password'"; 
$query = $this->db->query($q); 
if($query->num_rows()>0) 
{ 
foreach($query->result() as $rows) 
{ 
//add all data to session 
$newdata = array('user_id' => $rows- 
>Id,'username' => $rows->UserName,'email' => $rows- 
>EmailId,'logged_in' => TRUE); 
} 
$this->session->set_userdata($newdata); 
return true; 
} 
return false; 
}
//Update 
$this->load->db(); 
$this->db->update('tablename',$data); 
$this->db->where('id',$id); 
//delete 
$this->load->db(); 
$this->db->delete('tablename',$data); 
$this->db->where('id',$id);
SESSION STARTING 
<?php 
Session start(); 
$_session['id']=$id; 
$_session['username']=$username; 
$_session['login true']='valid'; 
if($-session['login true']=='valid') 
{ 
$this->load->view('profile.php'); 
} 
else 
{ 
$this->load->view('login.php'); 
}
FORM VALIDATION 
public function registration() 
{ 
$this->load->library('form_validation'); 
// field name, error message, validation rules 
$this->form_validation->set_rules('firstname', 'First 
Name', 'trim|required|min_length[3]|xss_clean'); 
$this->form_validation->set_rules('lastname', 'Last 
Name', 'trim|required|min_length[1]|xss_clean'); 
$this->form_validation->set_rules('username', 'User 
Name','trim|required|min_length[4]|xss_clean| 
is_unique[user.UserName]'); 
}
if($this->form_validation->run() == FALSE) 
{ 
$this->load->view('Register_form'); 
} 
else 
{ 
$this->load->model('db_model'); 
$this->db_model->add_user(); 
}
USEFUL LINKS 
 www.codeigniter.com
 User Guide of CodeIgniter 
 Wikipedia 
 Slideshare
THANK YOU

More Related Content

PDF
PHP & MVC
Chris Weldon
 
PDF
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Caldera Labs
 
PPT
Joomlapresentation
jlleblanc
 
PPT
JoomlaEXPO Presentation by Joe LeBlanc
John Coonen
 
PDF
Rails 3: Dashing to the Finish
Yehuda Katz
 
PPTX
Authenticating and Securing Node.js APIs
Jimmy Guerrero
 
PPTX
18.register login
Razvan Raducanu, PhD
 
PPTX
Introduction to CodeIgniter
Piti Suwannakom
 
PHP & MVC
Chris Weldon
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Caldera Labs
 
Joomlapresentation
jlleblanc
 
JoomlaEXPO Presentation by Joe LeBlanc
John Coonen
 
Rails 3: Dashing to the Finish
Yehuda Katz
 
Authenticating and Securing Node.js APIs
Jimmy Guerrero
 
18.register login
Razvan Raducanu, PhD
 
Introduction to CodeIgniter
Piti Suwannakom
 

What's hot (20)

PDF
Webapps without the web
Remy Sharp
 
PDF
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
 
PPT
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
 
PDF
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha
 
PPTX
Javascript first-class citizenery
toddbr
 
PDF
jQuery Proven Performance Tips & Tricks
Addy Osmani
 
PPTX
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Sencha
 
PDF
Laravel 로 배우는 서버사이드 #5
성일 한
 
PDF
Building a Backend with Flask
Make School
 
PPTX
Ext JS Architecture Best Practices - Mitchell Simeons
Sencha
 
PDF
Learn about Eclipse e4 from Lars Vogel at SF-JUG
Marakana Inc.
 
PDF
[Bristol WordPress] Supercharging WordPress Development
Adam Tomat
 
PDF
Efficient Rails Test-Driven Development - Week 6
Marakana Inc.
 
PDF
The Complementarity of React and Web Components
Andrew Rota
 
PPTX
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
PPTX
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Sencha
 
PDF
AtlasCamp 2015: Using add-ons to build add-ons
Atlassian
 
PDF
Devoxx 2014-webComponents
Cyril Balit
 
PDF
jQuery and Rails: Best Friends Forever
stephskardal
 
PDF
AtlasCamp 2015: Web technologies you should be using now
Atlassian
 
Webapps without the web
Remy Sharp
 
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
Sencha
 
Sencha Roadshow 2017: Modernizing the Ext JS Class System and Tooling
Sencha
 
Javascript first-class citizenery
toddbr
 
jQuery Proven Performance Tips & Tricks
Addy Osmani
 
SenchaCon 2016: Learn the Top 10 Best ES2015 Features - Lee Boonstra
Sencha
 
Laravel 로 배우는 서버사이드 #5
성일 한
 
Building a Backend with Flask
Make School
 
Ext JS Architecture Best Practices - Mitchell Simeons
Sencha
 
Learn about Eclipse e4 from Lars Vogel at SF-JUG
Marakana Inc.
 
[Bristol WordPress] Supercharging WordPress Development
Adam Tomat
 
Efficient Rails Test-Driven Development - Week 6
Marakana Inc.
 
The Complementarity of React and Web Components
Andrew Rota
 
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
Introducing ExtReact: Adding Powerful Sencha Components to React Apps
Sencha
 
AtlasCamp 2015: Using add-ons to build add-ons
Atlassian
 
Devoxx 2014-webComponents
Cyril Balit
 
jQuery and Rails: Best Friends Forever
stephskardal
 
AtlasCamp 2015: Web technologies you should be using now
Atlassian
 
Ad

Similar to Codegnitorppt (20)

PPT
Introduction To Code Igniter
Amzad Hossain
 
PDF
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
PPTX
Codeigniter
ShahRushika
 
PPTX
CodeIgniter & MVC
Jamshid Hashimi
 
PPTX
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
PDF
Codeigniter
Joram Salinas
 
PPT
Codeigniter simple explanation
Arumugam P
 
PPT
Benefits of the CodeIgniter Framework
Toby Beresford
 
PPTX
CODE IGNITER
Yesha kapadia
 
PPT
Code igniter overview
umesh patil
 
PPT
Codeigniter
minhrau111
 
ODP
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
DOCX
Codeigniter
Chirag Parmar
 
PPT
Introduction To CodeIgniter
schwebbie
 
PPTX
codeigniter
Mohamed Syam
 
PPTX
Codeigniter
shah baadshah
 
PDF
Codeigniter
EmmanuelMasyenene1
 
PPTX
Codeignitor
Gandhi Ravi
 
PPT
PHP Frameworks and CodeIgniter
KHALID C
 
Introduction To Code Igniter
Amzad Hossain
 
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
Codeigniter
ShahRushika
 
CodeIgniter & MVC
Jamshid Hashimi
 
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
Codeigniter
Joram Salinas
 
Codeigniter simple explanation
Arumugam P
 
Benefits of the CodeIgniter Framework
Toby Beresford
 
CODE IGNITER
Yesha kapadia
 
Code igniter overview
umesh patil
 
Codeigniter
minhrau111
 
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
Codeigniter
Chirag Parmar
 
Introduction To CodeIgniter
schwebbie
 
codeigniter
Mohamed Syam
 
Codeigniter
shah baadshah
 
Codeigniter
EmmanuelMasyenene1
 
Codeignitor
Gandhi Ravi
 
PHP Frameworks and CodeIgniter
KHALID C
 
Ad

Recently uploaded (20)

PDF
Top 10 UI/UX Design Agencies in Dubai Shaping Digital Experiences
Tenet UI UX
 
PDF
Garage_Aluminium_Doors_PresenGarage Aluminium Doorstation.pdf
Royal Matrixs
 
PPTX
Landscape assignment for historical garden
aditikoshley2
 
PDF
Shayna Andrieze Yjasmin Goles - Your VA!
shaynagoles31
 
PPTX
United Nation - CoUnited Nation - CoUnited Nation - Copy (2).pptx
mangalindanjerremyjh
 
PPTX
UCSP-Quarter 1-Week 6-Powerpoint Presentation
EmyMaquiling1
 
PPTX
Brown Beige Vintage Style History Project Presentation.pptx
mb3030336
 
PDF
PowerPoint Presentation -- Jennifer Kyte -- 9786400311489 -- ade9381d14f65b06...
Adeel452922
 
PPTX
KOTA LAMA BANYUMAS.pptxxxxxxxxxxxxxxxxxxxx
pt satwindu utama
 
PDF
How Neuroscience and AI Inspire Next-Gen Design
Andrea Macruz
 
PPTX
Engagement for marriage life ethics b.pptx
SyedBabar19
 
PPTX
UCSP-Quarter 1-Week 5-Powerpoint Presentation
EmyMaquiling1
 
PPTX
The birth & Rise of python.pptx vaibhavd
vaibhavdobariyal79
 
PPTX
Web Design: Enhancing User Experience & Brand Value
ashokmakwana0303
 
PPTX
3. Introduction to Materials and springs.pptx
YESIMSMART
 
PPTX
Presentation_food_packaging material [1].pptx
dayataryash7
 
PPTX
Landscape assignment for landscape architecture
aditikoshley2
 
PPTX
Template of Different Slide Designs to Use
kthomas47
 
PDF
Portfolio Arch Estsabel Chourio - Interiorism,
arqeech
 
PPTX
Introduction-to-Graphic-Design-and-Adobe-Photoshop.pptx
abdullahedpk
 
Top 10 UI/UX Design Agencies in Dubai Shaping Digital Experiences
Tenet UI UX
 
Garage_Aluminium_Doors_PresenGarage Aluminium Doorstation.pdf
Royal Matrixs
 
Landscape assignment for historical garden
aditikoshley2
 
Shayna Andrieze Yjasmin Goles - Your VA!
shaynagoles31
 
United Nation - CoUnited Nation - CoUnited Nation - Copy (2).pptx
mangalindanjerremyjh
 
UCSP-Quarter 1-Week 6-Powerpoint Presentation
EmyMaquiling1
 
Brown Beige Vintage Style History Project Presentation.pptx
mb3030336
 
PowerPoint Presentation -- Jennifer Kyte -- 9786400311489 -- ade9381d14f65b06...
Adeel452922
 
KOTA LAMA BANYUMAS.pptxxxxxxxxxxxxxxxxxxxx
pt satwindu utama
 
How Neuroscience and AI Inspire Next-Gen Design
Andrea Macruz
 
Engagement for marriage life ethics b.pptx
SyedBabar19
 
UCSP-Quarter 1-Week 5-Powerpoint Presentation
EmyMaquiling1
 
The birth & Rise of python.pptx vaibhavd
vaibhavdobariyal79
 
Web Design: Enhancing User Experience & Brand Value
ashokmakwana0303
 
3. Introduction to Materials and springs.pptx
YESIMSMART
 
Presentation_food_packaging material [1].pptx
dayataryash7
 
Landscape assignment for landscape architecture
aditikoshley2
 
Template of Different Slide Designs to Use
kthomas47
 
Portfolio Arch Estsabel Chourio - Interiorism,
arqeech
 
Introduction-to-Graphic-Design-and-Adobe-Photoshop.pptx
abdullahedpk
 

Codegnitorppt

  • 1. Submitted By Reshma vijayan .R
  • 2.  Introduction  Why Framework not Scratch?  MVC ( Model View Controller) Architecture  What is CodeIgniter ????  Application Flow of CodeIgniter  CodeIgniter URL  Controllers  Views  Models  CRUD operations  Session starting  Form validation  Q/A  Reference
  • 3.  Key Factors of a Development  Interface Design  Business Logic  Database Manipulation  Advantage of Framework  Provide Solutions to Common problems  Abstract Levels of functionality  Make Rapid Development Easier  Disadvantage of Scratch Development  Make your own Abstract Layer  Solve Common Problems Yourself  The more Typing Speed the more faster
  • 4.  Separates User Interface From Business Logic  Model - Encapsulates core application data and functionality Business Logic.  View - obtains data from the model and presents it to the user.  Controller - receives and translates input to requests on the model or the view Figure : 01
  • 5.  An Open Source Web Application Framework  Nearly Zero Configuration  MVC ( Model View Controller ) Architecture  Multiple DB (Database) support  Caching  Modules  Validation  Rich Sets of Libraries for Commonly Needed Tasks  Has a Clear, Thorough documentation
  • 6. Figure : 2 [ Application Flow of CodeIgniter]
  • 7. URL in CodeIgniter is Segment Based. www.your-site.com/news/article/my_article Segments in a URI www.your-site.com/class/function/ID CodeIgniter Optionally Supports Query String URL www.your-site.com/index.php?c=news&m=article&ID=345
  • 8. A Class file resides under “application/controllers” www.your-site.com/index.php/first <?php class First extends CI_Controller{ function First() { parent::Controller(); } function index() { echo “<h1> Hello CUET !! </h1> “; } } ?> // Output Will be “Hello CUET!!” • Note: • Class names must start with an Uppercase Letter. • In case of “constructor” you must use “parent::Controller();”
  • 9. In This Particular Code www.your-site.com/index.php/first/bdosdn/world <?php class First extends Controller{ function index() { echo “<h1> Hello CUET !! </h1> “; } function bdosdn( $location ) { echo “<h2> Hello $location !! </h2>”; } } ?> // Output Will be “Hello world !!” • Note: • The ‘Index’ Function always loads by default. Unless there is a second segment in the URL
  • 10.  A Webpage or A page Fragment  Should be placed under “application/views”  Never Called Directly 10 web_root/myci/system/application/views/myview.php <html> <title> My First CodeIgniter Project</title> <body> <h1> Welcome ALL … To My .. ::: First Project ::: . . . </h1> </body> </html>
  • 11. Calling a VIEW from Controller $this->load->view(‘myview’); Data Passing to a VIEW from Controller function index() { $var = array( ‘full_name’ => ‘Amzad Hossain’, ‘email’ => ‘[email protected]’ ); $this->load->view(‘myview’, $var); } <html> <title> ..::Personal Info::.. </title> <body> Full Name : <?php echo $full_name;?> <br /> E-mail : <?=email;?> <br /> </body> </html>
  • 12. Designed to work with Information of Database Models Should be placed Under “application/models/” <?php class Mymodel extend Model{ function Mymodel() { parent::Model(); } function get_info() { $query = $this->db->get(‘name’, 10); /*Using ActiveRecord*/ return $query->result(); } } ?> Loading a Model inside a Controller $this->load->model(‘mymodel’); $data = $this->mymodel->get_info();
  • 13. CRUD OPERATIONS IN MVC ➢Create ➢Read ➢Update ➢Delete
  • 14. DATABASE CREATION //Create CREATE TABLE `user` ( `id` INT( 50 ) NOT NULL AUTO_INCREMENT , `username` VARCHAR( 50 ) NOT NULL , `email` VARCHAR( 100 ) NOT NULL , `password` VARCHAR( 255 ) NOT NULL , PRIMARY KEY ( `id` ) )
  • 15. DATABASE CONFIGURATION Open application/config/database.php $config['hostname'] = "localhost"; $config['username'] = "root"; $config['password'] = ""; $config['database'] = "mydatabase"; $config['dbdriver'] = "mysql";
  • 16. CONFIGURATION Then open application/config/config.php $config['base_url'] = 'http://localhost/ci_user'; Open application/config/autoload.php $autoload['libraries'] = array('session','database'); $autoload['helper'] = array('url','form'); Open application/config/routes.php, change default controller to user controller
  • 17. Creating our view page Create a blank document in the views file (application -> views) and name it Registration.php /Login.php Using HTML and CSS create a simple registration form
  • 18. public function add_user() { $data=array ( 'FirstName' => $this->input- >post('firstname'), 'LastName'=>$this->input- >post('lastname'), 'Gender'=>$this->input->post('gender'), 'UserName'=>$this->input- >post('username'), 'EmailId'=>$this->input->post('email'), 'Password'=>$this->input- >post('password')); $this->db->insert('user',$data); }
  • 19. //select public function doLogin($username, $password) { $q = "SELECT * FROM representative WHERE UserName= '$username' AND Password = '$password'"; $query = $this->db->query($q); if($query->num_rows()>0) { foreach($query->result() as $rows) { //add all data to session $newdata = array('user_id' => $rows- >Id,'username' => $rows->UserName,'email' => $rows- >EmailId,'logged_in' => TRUE); } $this->session->set_userdata($newdata); return true; } return false; }
  • 20. //Update $this->load->db(); $this->db->update('tablename',$data); $this->db->where('id',$id); //delete $this->load->db(); $this->db->delete('tablename',$data); $this->db->where('id',$id);
  • 21. SESSION STARTING <?php Session start(); $_session['id']=$id; $_session['username']=$username; $_session['login true']='valid'; if($-session['login true']=='valid') { $this->load->view('profile.php'); } else { $this->load->view('login.php'); }
  • 22. FORM VALIDATION public function registration() { $this->load->library('form_validation'); // field name, error message, validation rules $this->form_validation->set_rules('firstname', 'First Name', 'trim|required|min_length[3]|xss_clean'); $this->form_validation->set_rules('lastname', 'Last Name', 'trim|required|min_length[1]|xss_clean'); $this->form_validation->set_rules('username', 'User Name','trim|required|min_length[4]|xss_clean| is_unique[user.UserName]'); }
  • 23. if($this->form_validation->run() == FALSE) { $this->load->view('Register_form'); } else { $this->load->model('db_model'); $this->db_model->add_user(); }
  • 24. USEFUL LINKS  www.codeigniter.com
  • 25.  User Guide of CodeIgniter  Wikipedia  Slideshare