CodeIgniter - [Overview]
CodeIgniter is a fast, minimalistic PHP 4/5 framework.
MVC
• CodeIgniter is built on a design pattern called MVC.
• MVC stands for Model View Controller and is a common design pattern for web design.
• Models encapsulate data and the manipulation thereof.
• Views handle presentation of the Models.
• Controllers handle routing, external libraries, and deciding which Model it’s going to send to
which View.
“Under the Hood”
• CodeIgniter works by building a “super object” on every call.
• This makes the flow very easy to follow.
CodeIgniter Flow
index.php Error Reporting
System Folder
CodeIgniter CI Version
Commons
Common functions
Load functions
Intercept errors
Define custom error handlers
Config [App] Application Specific Configuration
Benchmarki
ng
Hooks
CodeIgniter Flow
• Questions?
URI Patterns
• URL’s are URI’s. URI’s are Uniform Resource Identifier
• CodeIgniter uses the URI to determine what action to perform with the request.
http://
www.example.co
m
/blog
/
index.php
/view /10
http://www.example.com/index.php/blog/view/10
URL Domain File Controller Method (action) Parameters
Application Flow
• Controller objects are created
• This loads any libraries / helpers needed as well as any Models you intend to reference
• Corresponding named function (action) is called and given any parameters present
• This function typically loads views which are then displayed
¡Expert Tip!
• The unsightly index.php from the URI can be removed with a .htaccess rule
RewriteEngine on # Turn RewriteEngine on if neededRewriteCond
$1 !^(index.php|images|css|js) # Match everything except our non php filesRewriteCond %
{HTTP_HOST} ^example.com # Only match one specific vhostRewriteRule ^(.*)$
/blog/index.php/basic/$1 # Magic!
MVC Design with CodeIgniter
• CodeIgniter enforces MVC if a pretty lenient way.
• You could write all your logic in Views if you wanted to.
• You can completely disregard Models.
• You shouldn’t misuse MVC.
• It leads to problems down the road. Even if you aren’t planning on extending the
Application.
Controllers
• Controllers get called in response to a URL route
• Controllers should take any given parameters and use them to create a Model.
• This Model then gets passed to the View.
• Do all Views have Models? Ideally, yes. However this is often impractical.
• Use private functions to encapsulate repetitive logic.
• Are you checking for $this->session->user every time and redirecting if not found? Put it
into a private function and call $this->_require_user() instead.
Models
• Models are objects. They typically interface with a data source.
• Active Record gives Models database connectivity and query ability.
• DataMapper (OZ) is has additional features if you need them.
• Simplicity to the point of insanity.
Views
• Views are almost 100% HTML.
• A view takes information passed to it and splices those values into the HTML document.
• Views are modular, you can load multiple views for any given request.
• You can load views from other views
• Create a directory structure that makes sense.
¡Expert Tip!
• Don’t use PHP short tags. They are from the devil.
• Don’t write logic in your views. If this show that: Fine. If this show that create new User: NO!
• Don’t ‘echo’ out HTML. This does not turn into a JSP where everything is escaped and
written out anyway. This is HTML that is pre-processed by the PHP engine before being
served.
• Do write separate views for separate things. Listing a bunch of blog posts?
foreach($posts as $post)
{
$this->load->view(‘shared/post’, $post);
}
Libraries
• Not full of books.
• Libraries allow you to interface with external classes.
• Session management
• reCaptcha
• API’s
• Benchmarking, Calendar, Encryption, Forms, Profilers, URI, Validation, etc.
• CodeIgniter has some very useful ones built in. Check them out.
Helpers
• Globally available functions.
• Use them in Controllers, Views, or Models.
Tying It All Together
• CodeIgniter is a simple framework for you to build complex applications.
• Questions?

More Related Content

PPT
Codeigniter simple explanation
PPTX
SoCal Code Camp 2011 - ASP.NET 4.5
PDF
MVC with Zend Framework
PDF
Building Web Applications with Zend Framework
PPTX
Zend MVC pattern based Framework – Best for Enterprise web applications
PPTX
AngularJS Scopes
PPTX
Fast Track introduction to ASP.NET MVC
PPTX
Introduction of ASP.NET MVC and AngularJS
Codeigniter simple explanation
SoCal Code Camp 2011 - ASP.NET 4.5
MVC with Zend Framework
Building Web Applications with Zend Framework
Zend MVC pattern based Framework – Best for Enterprise web applications
AngularJS Scopes
Fast Track introduction to ASP.NET MVC
Introduction of ASP.NET MVC and AngularJS

What's hot (20)

PPTX
Getting started with MVC 5 and Visual Studio 2013
PPTX
Develop a Basic REST API from Scratch Using TDD with Val Karpov
DOCX
Rails Concept
PPTX
Entity Framework Core 1.0
PDF
Require.JS
PDF
SpringMVC
PPTX
Introduction to Angular JS
PPTX
Introduction to ASP.NET MVC
PDF
Introduction to ASP.NET MVC
PPT
Angularjs for kolkata drupal meetup
PPTX
Asp.net c# MVC-5 Training-Day-1 of Day-9
PDF
Generic repository pattern with ASP.NET MVC and Entity Framework
PPTX
Building great spa’s with angular js, asp.net mvc and webapi
PPTX
Laravel session 1
PDF
Headless cms architecture
PPTX
ASP.NET - Ivan Marković
PPTX
MVC 6 - Tag Helpers and View Components
PPTX
Asp.net c# MVC-5 Training-Day-2 of Day-9
PPTX
Rest api to integrate with your site
Getting started with MVC 5 and Visual Studio 2013
Develop a Basic REST API from Scratch Using TDD with Val Karpov
Rails Concept
Entity Framework Core 1.0
Require.JS
SpringMVC
Introduction to Angular JS
Introduction to ASP.NET MVC
Introduction to ASP.NET MVC
Angularjs for kolkata drupal meetup
Asp.net c# MVC-5 Training-Day-1 of Day-9
Generic repository pattern with ASP.NET MVC and Entity Framework
Building great spa’s with angular js, asp.net mvc and webapi
Laravel session 1
Headless cms architecture
ASP.NET - Ivan Marković
MVC 6 - Tag Helpers and View Components
Asp.net c# MVC-5 Training-Day-2 of Day-9
Rest api to integrate with your site
Ad

Similar to Code igniter overview (20)

PPTX
Asp.net mvc presentation by Nitin Sawant
PDF
CodeIgniter
PDF
Php and-mvc
PPTX
ASP.NET MVC 5 - EF 6 - VS2015
PPTX
ASP.NET MVC Best Practices malisa ncube
PDF
Asp 1-mvc introduction
PPTX
Best Practices for Building WordPress Applications
PDF
Best Practices for WordPress
PDF
Codeigniter
PPTX
2011 NetUG HH: ASP.NET MVC & HTML 5
PDF
Presentation 1 Web--dev
PPTX
They why behind php frameworks
PPTX
Seminar.pptx
PPTX
MVC Framework
DOCX
Codeigniter
PPTX
MVC architecture by Mohd.Awais on 18th Aug, 2017
PDF
Apache Drill (ver. 0.2)
PPTX
PDF
Asp 1a-aspnetmvc
Asp.net mvc presentation by Nitin Sawant
CodeIgniter
Php and-mvc
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC Best Practices malisa ncube
Asp 1-mvc introduction
Best Practices for Building WordPress Applications
Best Practices for WordPress
Codeigniter
2011 NetUG HH: ASP.NET MVC & HTML 5
Presentation 1 Web--dev
They why behind php frameworks
Seminar.pptx
MVC Framework
Codeigniter
MVC architecture by Mohd.Awais on 18th Aug, 2017
Apache Drill (ver. 0.2)
Asp 1a-aspnetmvc
Ad

More from umesh patil (20)

PPTX
Ccna security
PPTX
Array in c language
PPTX
Array in c language
PPTX
Jquery Preparation
PPTX
Cloud computing
PPT
Static and dynamic polymorphism
PPTX
Introduction to asp .net
PPTX
C language
PPTX
Html and css presentation
PPTX
Html Presentation
PPTX
Cloud computing
PPT
Oops and c fundamentals
PPT
Java script
PPTX
Function in c program
PPTX
css and wordpress
PPTX
css and wordpress
PPTX
Php vs asp
PPTX
Ccna security
PPT
Cloud computing
PPTX
Cloud computing
Ccna security
Array in c language
Array in c language
Jquery Preparation
Cloud computing
Static and dynamic polymorphism
Introduction to asp .net
C language
Html and css presentation
Html Presentation
Cloud computing
Oops and c fundamentals
Java script
Function in c program
css and wordpress
css and wordpress
Php vs asp
Ccna security
Cloud computing
Cloud computing

Recently uploaded (20)

PPTX
Macbeth play - analysis .pptx english lit
PPT
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
PPTX
Thinking Routines and Learning Engagements.pptx
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
PPTX
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
PDF
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
PDF
The TKT Course. Modules 1, 2, 3.for self study
PPTX
2025 High Blood Pressure Guideline Slide Set.pptx
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
PUBH1000 - Module 6: Global Health Tute Slides
PDF
Solved Past paper of Pediatric Health Nursing PHN BS Nursing 5th Semester
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
semiconductor packaging in vlsi design fab
PDF
0520_Scheme_of_Work_(for_examination_from_2021).pdf
PDF
Compact First Student's Book Cambridge Official
PPTX
PLASMA AND ITS CONSTITUENTS 123.pptx
PDF
Disorder of Endocrine system (1).pdfyyhyyyy
PPTX
What’s under the hood: Parsing standardized learning content for AI
Macbeth play - analysis .pptx english lit
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
Thinking Routines and Learning Engagements.pptx
Nurlina - Urban Planner Portfolio (english ver)
Skin Care and Cosmetic Ingredients Dictionary ( PDFDrive ).pdf
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
Fun with Grammar (Communicative Activities for the Azar Grammar Series)
The TKT Course. Modules 1, 2, 3.for self study
2025 High Blood Pressure Guideline Slide Set.pptx
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PUBH1000 - Module 6: Global Health Tute Slides
Solved Past paper of Pediatric Health Nursing PHN BS Nursing 5th Semester
Journal of Dental Science - UDMY (2021).pdf
semiconductor packaging in vlsi design fab
0520_Scheme_of_Work_(for_examination_from_2021).pdf
Compact First Student's Book Cambridge Official
PLASMA AND ITS CONSTITUENTS 123.pptx
Disorder of Endocrine system (1).pdfyyhyyyy
What’s under the hood: Parsing standardized learning content for AI

Code igniter overview

  • 1. CodeIgniter - [Overview] CodeIgniter is a fast, minimalistic PHP 4/5 framework.
  • 2. MVC • CodeIgniter is built on a design pattern called MVC. • MVC stands for Model View Controller and is a common design pattern for web design. • Models encapsulate data and the manipulation thereof. • Views handle presentation of the Models. • Controllers handle routing, external libraries, and deciding which Model it’s going to send to which View.
  • 3. “Under the Hood” • CodeIgniter works by building a “super object” on every call. • This makes the flow very easy to follow.
  • 4. CodeIgniter Flow index.php Error Reporting System Folder CodeIgniter CI Version Commons Common functions Load functions Intercept errors Define custom error handlers Config [App] Application Specific Configuration Benchmarki ng Hooks
  • 6. URI Patterns • URL’s are URI’s. URI’s are Uniform Resource Identifier • CodeIgniter uses the URI to determine what action to perform with the request. http:// www.example.co m /blog / index.php /view /10 http://www.example.com/index.php/blog/view/10 URL Domain File Controller Method (action) Parameters
  • 7. Application Flow • Controller objects are created • This loads any libraries / helpers needed as well as any Models you intend to reference • Corresponding named function (action) is called and given any parameters present • This function typically loads views which are then displayed
  • 8. ¡Expert Tip! • The unsightly index.php from the URI can be removed with a .htaccess rule RewriteEngine on # Turn RewriteEngine on if neededRewriteCond $1 !^(index.php|images|css|js) # Match everything except our non php filesRewriteCond % {HTTP_HOST} ^example.com # Only match one specific vhostRewriteRule ^(.*)$ /blog/index.php/basic/$1 # Magic!
  • 9. MVC Design with CodeIgniter • CodeIgniter enforces MVC if a pretty lenient way. • You could write all your logic in Views if you wanted to. • You can completely disregard Models. • You shouldn’t misuse MVC. • It leads to problems down the road. Even if you aren’t planning on extending the Application.
  • 10. Controllers • Controllers get called in response to a URL route • Controllers should take any given parameters and use them to create a Model. • This Model then gets passed to the View. • Do all Views have Models? Ideally, yes. However this is often impractical. • Use private functions to encapsulate repetitive logic. • Are you checking for $this->session->user every time and redirecting if not found? Put it into a private function and call $this->_require_user() instead.
  • 11. Models • Models are objects. They typically interface with a data source. • Active Record gives Models database connectivity and query ability. • DataMapper (OZ) is has additional features if you need them. • Simplicity to the point of insanity.
  • 12. Views • Views are almost 100% HTML. • A view takes information passed to it and splices those values into the HTML document. • Views are modular, you can load multiple views for any given request. • You can load views from other views • Create a directory structure that makes sense.
  • 13. ¡Expert Tip! • Don’t use PHP short tags. They are from the devil. • Don’t write logic in your views. If this show that: Fine. If this show that create new User: NO! • Don’t ‘echo’ out HTML. This does not turn into a JSP where everything is escaped and written out anyway. This is HTML that is pre-processed by the PHP engine before being served. • Do write separate views for separate things. Listing a bunch of blog posts? foreach($posts as $post) { $this->load->view(‘shared/post’, $post); }
  • 14. Libraries • Not full of books. • Libraries allow you to interface with external classes. • Session management • reCaptcha • API’s • Benchmarking, Calendar, Encryption, Forms, Profilers, URI, Validation, etc. • CodeIgniter has some very useful ones built in. Check them out.
  • 15. Helpers • Globally available functions. • Use them in Controllers, Views, or Models.
  • 16. Tying It All Together • CodeIgniter is a simple framework for you to build complex applications. • Questions?