SlideShare a Scribd company logo
CodeIgniter
Standard PHP Framework
Presented by: Rushika Shah
Introduction To CodeIgniter
 What is CodeIgniter ?
 Why to use CodeIgniter ?
 How CodeIgniter works ?
 M-V-C Architecture in CodeIgniter
 Clean URL in CodeIgniter
 Installation of CodeIgniter
 Folder Structure of CodeIgniter
 First Step for Development
 Basic application in CodeIgniter
What is CodeIgniter ?
 CodeIgniter is a PHP MVC framework used for
developing web applications rapidly. Its goal is to
enable you to develop projects much faster than
you could.
 if you were writing code from scratch, by providing
a rich set of libraries for commonly needed tasks
when its not necessary, CodeIgniter will help you
by providing collection of libraries for performing
various operations in your web application.
 CodeIgniter lets you creatively focus on your
project by minimizing the amount of code needed
for a given task.
Why to use CodeIgniter ?
 Small footprints
 Loosely coupled
 Open source
 Blazing fast
 Model-View-Controller based system
 Fully featured database classes
 Excellent Documentation
 Well supported by an active community
 Easy to configure
 Packs a Punch
 Extensible
How CodeIgniter works ?
M-V-C Architecture in
CodeIgniter
 CodeIgniter is based on the Model-View-Controller
development pattern. MVC is a software approach
that separates application logic from presentation.
1. The Model represents your data structures.
Typically your model classes will contain functions
that help you retrieve, insert, and update
information in your database.
2. The View is the information that is being
presented to a user. A View will normally be a web
page.
3. The Controller serves as
an intermediary between the Model, the View, and
any other resources needed to process the HTTP
request and generate a web page.
Clean URL in CodeIgniter
 The URLs generated by CodeIgniter are clean and
search-engine friendly. Rather than using the
standard “query string” approach to URLs that is
synonymous with dynamic systems, CodeIgniter
uses a segment based approach.
Installation of CodeIgniter
 https://codeigniter.com/download
 Install the CodeIgniter framework from the
given link.
 Unzip the package.
 Upload the CodeIgniter folders and files to
your server. Normally the index.php file will
be at your root.
Folder Structure of
CodeIgniter
First Step for Development
 Give the name to the CodeIgniter folder which we
unzip.
 Open the application/config/config.php file with a
text editor and set your base URL.
 If you intend to use a database, open the
application/config/database.php file with a text
editor and set your database settings.
Load all the necessary stuff
 CodeIgniter comes with an “Auto-load” feature that
permits libraries, helpers, and models to be initialized
automatically every time the system runs. If you need
certain resources globally throughout your application
you should consider auto-loading them for convenience.
 To autoload resources, open the
application/config/autoload.php file and add the item
you want loaded to the autoload array.
 Example :
$autoload['libraries']=array('form_validation','database',
'session');
Routing in CodeIgniter
 Routing rules are defined in
your application/config/routes.php file. In it you’ll
see an array called $route that permits you to
specify your own routing criteria.
 After all the basic changes we have to give a route
for our application which is set a default controller.
 application/config/routes.php file
$route['default_controller'] = 'admin';
 Remove the index_page from the
application/config/config.php file and leave it blank.
$config['index_page'] = '';
 Lastly place the .htaccess file in the main project
folder, now all the routing process is done
Libraries
 The essential part of a CodeIgniter framework is its
libraries. It provides a rich set of libraries, which
indirectly increase the speed of developing an
application. The system library is located at
system/libraries. All we need to do is to load the
library that we want to use.
 Syntax for loading library into file :
$this->load->library(‘library_name');
 Syntax for loading library with running system in
application/config/autoload.php :
$autoload[‘library'] = array(‘library_name');
List of Libraries
 Benchmarking Class
 Email Class
 Encryption Library
 Form Validation
 FTP Class
 Input Class
 Loader Class
 Pagination Class
 Security Class
 Session Library
 URI Class
 Zip Encoding Class
Helpers
 Helpers, as the name suggests, help you with
tasks. Each helper file is simply a collection of
functions in a particular category.
 They are simple, procedural functions. Each helper
function performs one specific task, with no
dependence on other functions.
 CodeIgniter does not load Helper Files by default,
so the first step in using a Helper is to load it. Once
loaded, it becomes globally available in your
controller and views.
 Syntax for loading helper into file :
$this->load->helper(‘helper_name');
 Syntax for loading helper with running system in
application/config/autoload.php :
$autoload[‘helper'] = array('helper_name');
List of Helpers
 Array Helper
 Captcha Helper
 Cookie Helper
 Date Helper
 Email Helper
 File Helper
 Form Helper
 HTML Helper
 Security Helper
 Smiley Helper
 Typography Helper
 URL Helper
Models
 Models are PHP classes that are designed to work
with information in your database.
 CI_Model class must be extended Whenever u
want to create Your own Model.
 Model name must be Started with Capital letter
 Model name and file name must be Similar
 Syntax for loading model into file :
$this->load->model('model_name');
 Syntax for loading model with running system in
application/config/autoload.php :
$autoload['model'] = array('model_name');
Views
 A view is simply a web page, or a page fragment,
like a header, footer, sidebar, etc.
 Views are never called directly, they must be
loaded by a controller.
 Syntax for loading view into file :
$this->load->view(‘view_name');
Controllers
 Controllers are the heart of your application, as
they determine how HTTP requests should be
handled.
 CI_Controller class must be extended Whenever u
want to create Your own Controller.
 Controller name must be Started with Capital letter
 Controller name and file name must be Similar
Basic application in
CodeIgniter
There is a Product application which is used to insert
and display the data of different product.
 First we need to design database.
 Next we are made a basic changes in application
which are needed to start development.
 Next step is to design view files of the application.
 After that we are going to create model and
controller for the application and code according to
the functionality of application.
Application Interface
 Insert Product Into Database
 Retrieve products from Database
Codeigniter
Ad

More Related Content

What's hot (20)

WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTHWEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
WEB PROGRAMMING UNIT V BY BHAVSINGH MALOTH
Bhavsingh Maloth
 
Php hypertext pre-processor
Php   hypertext pre-processorPhp   hypertext pre-processor
Php hypertext pre-processor
Siddique Ibrahim
 
Advantages of Choosing PHP Web Development
Advantages of Choosing PHP Web DevelopmentAdvantages of Choosing PHP Web Development
Advantages of Choosing PHP Web Development
Grey Matter India Technologies PVT LTD
 
PHP .ppt
PHP .pptPHP .ppt
PHP .ppt
dinesh rana
 
Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2
Shahrzad Peyman
 
Apache Thrift : One Stop Solution for Cross Language Communication
Apache Thrift : One Stop Solution for Cross Language CommunicationApache Thrift : One Stop Solution for Cross Language Communication
Apache Thrift : One Stop Solution for Cross Language Communication
Piyush Goel
 
Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3Object Oriented Programming with Laravel - Session 3
Object Oriented Programming with Laravel - Session 3
Shahrzad Peyman
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
Alan Pinstein
 
01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
Geshan Manandhar
 
Xml parsing in codeigniter
Xml parsing in codeigniterXml parsing in codeigniter
Xml parsing in codeigniter
baabtra.com - No. 1 supplier of quality freshers
 
Introduction to-php
Introduction to-phpIntroduction to-php
Introduction to-php
AhmedAElHalimAhmed
 
PHP Project PPT
PHP Project PPTPHP Project PPT
PHP Project PPT
Pankil Agrawal
 
Php introduction
Php introductionPhp introduction
Php introduction
krishnapriya Tadepalli
 
php
phpphp
php
ajeetjhajharia
 
PHP Interview Questions
PHP Interview QuestionsPHP Interview Questions
PHP Interview Questions
MaryamAnwar10
 
Web programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh MalothWeb programming UNIT II by Bhavsingh Maloth
Web programming UNIT II by Bhavsingh Maloth
Bhavsingh Maloth
 
PHP LICTURES ..........
PHP LICTURES ..........PHP LICTURES ..........
PHP LICTURES ..........
Rashid Ahmad
 
Tech talk webtech
Tech talk webtechTech talk webtech
Tech talk webtech
Shehrevar Davierwala
 
Php notes
Php notesPhp notes
Php notes
Muthuganesh S
 
Cgi
CgiCgi
Cgi
Girish Srivastava
 

Similar to Codeigniter (20)

Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
Muhammad Hafiz Hasan
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
Amzad Hossain
 
CODE IGNITER
CODE IGNITERCODE IGNITER
CODE IGNITER
Yesha kapadia
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
Joram Salinas
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
minhrau111
 
codeigniter
codeignitercodeigniter
codeigniter
Utkarsh Chaturvedi
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
Commit University
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
KHALID C
 
CodeIgniter
CodeIgniterCodeIgniter
CodeIgniter
Sandun_Prasanna
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
Juan Antonio
 
Codeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginnerCodeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginner
aminbd
 
Yii php framework_honey
Yii php framework_honeyYii php framework_honey
Yii php framework_honey
Honeyson Joseph
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
Yash Mittal
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
Chirag Parmar
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP Yii
Folio3 Software
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
Bo-Yi Wu
 
contentDM
contentDMcontentDM
contentDM
spacecowboyian
 
sveltekit-en.pdf
sveltekit-en.pdfsveltekit-en.pdf
sveltekit-en.pdf
ssuser65180a
 
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplicationsGet things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
Bradley Holt
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
Amzad Hossain
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
Commit University
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
KHALID C
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
Juan Antonio
 
Codeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginnerCodeigniter, a MVC framework for beginner
Codeigniter, a MVC framework for beginner
aminbd
 
report_vendor_connect
report_vendor_connectreport_vendor_connect
report_vendor_connect
Yash Mittal
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP Yii
Folio3 Software
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
Bo-Yi Wu
 
Get things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplicationsGet things done with Yii - quickly build webapplications
Get things done with Yii - quickly build webapplications
Giuliano Iacobelli
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
Bradley Holt
 
Ad

Recently uploaded (20)

Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Ad

Codeigniter

  • 2. Introduction To CodeIgniter  What is CodeIgniter ?  Why to use CodeIgniter ?  How CodeIgniter works ?  M-V-C Architecture in CodeIgniter  Clean URL in CodeIgniter  Installation of CodeIgniter  Folder Structure of CodeIgniter  First Step for Development  Basic application in CodeIgniter
  • 3. What is CodeIgniter ?  CodeIgniter is a PHP MVC framework used for developing web applications rapidly. Its goal is to enable you to develop projects much faster than you could.  if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks when its not necessary, CodeIgniter will help you by providing collection of libraries for performing various operations in your web application.  CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.
  • 4. Why to use CodeIgniter ?  Small footprints  Loosely coupled  Open source  Blazing fast  Model-View-Controller based system  Fully featured database classes  Excellent Documentation  Well supported by an active community  Easy to configure  Packs a Punch  Extensible
  • 6. M-V-C Architecture in CodeIgniter  CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. 1. The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database. 2. The View is the information that is being presented to a user. A View will normally be a web page. 3. The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
  • 7. Clean URL in CodeIgniter  The URLs generated by CodeIgniter are clean and search-engine friendly. Rather than using the standard “query string” approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a segment based approach.
  • 8. Installation of CodeIgniter  https://codeigniter.com/download  Install the CodeIgniter framework from the given link.  Unzip the package.  Upload the CodeIgniter folders and files to your server. Normally the index.php file will be at your root.
  • 10. First Step for Development  Give the name to the CodeIgniter folder which we unzip.  Open the application/config/config.php file with a text editor and set your base URL.  If you intend to use a database, open the application/config/database.php file with a text editor and set your database settings.
  • 11. Load all the necessary stuff  CodeIgniter comes with an “Auto-load” feature that permits libraries, helpers, and models to be initialized automatically every time the system runs. If you need certain resources globally throughout your application you should consider auto-loading them for convenience.  To autoload resources, open the application/config/autoload.php file and add the item you want loaded to the autoload array.  Example : $autoload['libraries']=array('form_validation','database', 'session');
  • 12. Routing in CodeIgniter  Routing rules are defined in your application/config/routes.php file. In it you’ll see an array called $route that permits you to specify your own routing criteria.  After all the basic changes we have to give a route for our application which is set a default controller.  application/config/routes.php file $route['default_controller'] = 'admin';  Remove the index_page from the application/config/config.php file and leave it blank. $config['index_page'] = '';  Lastly place the .htaccess file in the main project folder, now all the routing process is done
  • 13. Libraries  The essential part of a CodeIgniter framework is its libraries. It provides a rich set of libraries, which indirectly increase the speed of developing an application. The system library is located at system/libraries. All we need to do is to load the library that we want to use.  Syntax for loading library into file : $this->load->library(‘library_name');  Syntax for loading library with running system in application/config/autoload.php : $autoload[‘library'] = array(‘library_name');
  • 14. List of Libraries  Benchmarking Class  Email Class  Encryption Library  Form Validation  FTP Class  Input Class  Loader Class  Pagination Class  Security Class  Session Library  URI Class  Zip Encoding Class
  • 15. Helpers  Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category.  They are simple, procedural functions. Each helper function performs one specific task, with no dependence on other functions.  CodeIgniter does not load Helper Files by default, so the first step in using a Helper is to load it. Once loaded, it becomes globally available in your controller and views.
  • 16.  Syntax for loading helper into file : $this->load->helper(‘helper_name');  Syntax for loading helper with running system in application/config/autoload.php : $autoload[‘helper'] = array('helper_name');
  • 17. List of Helpers  Array Helper  Captcha Helper  Cookie Helper  Date Helper  Email Helper  File Helper  Form Helper  HTML Helper  Security Helper  Smiley Helper  Typography Helper  URL Helper
  • 18. Models  Models are PHP classes that are designed to work with information in your database.  CI_Model class must be extended Whenever u want to create Your own Model.  Model name must be Started with Capital letter  Model name and file name must be Similar  Syntax for loading model into file : $this->load->model('model_name');  Syntax for loading model with running system in application/config/autoload.php : $autoload['model'] = array('model_name');
  • 19. Views  A view is simply a web page, or a page fragment, like a header, footer, sidebar, etc.  Views are never called directly, they must be loaded by a controller.  Syntax for loading view into file : $this->load->view(‘view_name');
  • 20. Controllers  Controllers are the heart of your application, as they determine how HTTP requests should be handled.  CI_Controller class must be extended Whenever u want to create Your own Controller.  Controller name must be Started with Capital letter  Controller name and file name must be Similar
  • 21. Basic application in CodeIgniter There is a Product application which is used to insert and display the data of different product.  First we need to design database.  Next we are made a basic changes in application which are needed to start development.  Next step is to design view files of the application.  After that we are going to create model and controller for the application and code according to the functionality of application.
  • 22. Application Interface  Insert Product Into Database
  • 23.  Retrieve products from Database