SlideShare a Scribd company logo
Introduction To CodeIgniter Mohammad Amzad Hossain Softwork Solutions [email_address]
Prerequisite OOP – Object Oriented Programming PHP MySQL
Index Introduction Evolution Of Web Development Basic Idea Of Web Framework Why Framework not Scratch?  MVC ( Model View Controller) Architecture What is CodeIgniter ???? Installation of CodeIgniter Application Flow of CodeIgniter CodeIgniter URL Controllers Views Models CodeIgniter Libraries Helpers A Basic Application Development Of Codeigniter Application Flow Q/A Reference
Evolution of Web Development How you first started building websites.
Evolution of Web Development How you’re building websites now.
Evolution of Web Development How you build websites with a framework
Basic Idea Of Web Framework A web application framework  Is a Software framework  Designed to support the development of  Dynamic websites Web applications Web services Aims to alleviate the overhead associated with common activities used in Web development.  Libraries for database access Templating frameworks Session management Often promote code reuse Many more  …….
Why Framework Not Scratch ?  Key Factors of a Development Interface Design  Business Logic  Database Manipulation User Access Control Advantage of Framework  Templating 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
MVC Architecture 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
What is CodeIgniter ??? An Open Source Web Application Framework  Nearly Zero Configuration MVC ( Model View Controller ) Architecture Multiple DB (Database) support DB Objects Templating Caching Modules Validation Rich Sets of Libraries for Commonly Needed Tasks Has a Clear, Thorough documentation
Installation of CodeIgniter Requirments Web Server -  Download & Install Apache PHP – 4.3.2 or Higher Database – MySQL ( support for other DB exists ) Installation  Download the latest version from  www.codeigniter.com  and unzip into your web root directory. Open  “application/config/config.php” and change base_url value to base url. For example:  http://localhost/myci/ To Use Database open “application/config/database.php” and change necessary values. Usually you have to change:  ‘hostname’, ‘username’, ‘password’, ‘datbase’. Start Your Web Server and Database Server and go to  http:// localhot/myci
Application Flow Of CodeIgniter Figure :  2  [ Application Flow of CodeIgniter]
CodeIgniter URL URL in CodeIgniter is Segment Based. Segments in a URI  CodeIgniter Optionally Supports Query String URL  www.your-site.com/ news / article / my_article www.your-site.com/ class / function / ID www.your-site.com/index.php? c=news & m=article & ID=345
Controllers A Class file resides under “application/controllers” www.your-site.com/index.php/ first <?php class  First  extends 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();”
Controllers In This Particular Code <?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 !!” www.your-site.com/index.php/ first / bdosdn/ world Note: The ‘Index’ Function always loads by default. Unless there is a second segment in the URL
VIEWS A Webpage or A page Fragment Should be placed under “application/views” Never Called Directly <html> <title> My First CodeIgniter Project</title> <body> <h1> Welcome ALL … To My .. ::: First Project ::: . . . </h1> </body> </html> web_root/myci/system/application/views/myview.php
VIEWS Calling a VIEW from Controller Data Passing to a VIEW from Controller $this->load->view(‘myview’); 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>
VIEWS There are 3 mechanism that can be utilize to show Dynamic Data inside a VIEW File -  Pure PHP -  PHP’s Alternative Syntax -  CodeIgniter’s Template Engine <!--  PHP’s Alternative Syntax --> <?php if( $for_this == true ):?> <h1> For This </h1> <?php elseif( $for_that == true ): ?> <h1> For That </h1> <?php else: ?> <h1> What </h1> <?php endif; ?> Note: There are other alternative syntax ‘for’, ‘foreach’, ‘while’
Models Designed to work with Information of Database Models Should be placed Under “application/models/” Loading a Model inside a Controller <?php  class  Mymodel  extend Model{ function Mymodel() { parent::Model(); } function  get_info () { $query = $this->db->get(‘name’, 10);  /*Using ActiveRecord*/ return $query->result(); } } ?> $this->load->model(‘mymodel’); $data = $this->mymodel->get_info();
CodeIgniter Libraries Special Purpose Classes Loading CodeIgniter Library Benchmarking Database Encryption Calendaring FTP Table File Uploading Email Image Manipulation Pagination Input and Security HTML Trackback Parser Session Template Unit Testing User Agent URI Validation $this->load->library(‘database’);
CodeIgniter Libraries Database Library Abstract Database Class support traditional structures and Active Record Pattern. Active Record Pattern General Approach function index() { $this->load->library(‘database’); $rslt =  $this->db->query (“ select first_name from user_name ”); foreach(  $rslt->result()  as $row_data)  echo  $row_data->first_name  . “<br />”; } function index() { $this->load->library(‘database’); $this->db->select(“first_name”); $rslt =  $this->db->get (“ user_name ”); foreach(  $rslt->result()  as $row_data)  echo  $row_data->first_name  . “<br />”; }
Helpers Simply a collection of functions in a particular category. Loading A Helper Inside a Controller Array Date File HTML Smiley Text URL Cookie Download Form Security String Directory E-mail Inflector XML Parser Typography $this->load->helper(‘helper_name’); $this->load->helper(array(‘form’,’url’) );
Helpers Form Helper form_open() form_open_multipart() form_input() form_textarea() form_checkbox() form_submit() form_close() URL Helper site_url() base_url() anchor() anchor_popup() mailto()
A Personal Blog Using CI
Questions  &  Answers
Useful Links www.codeigniter.com http://codeigniter.com/wiki/Summary_of_Resources_Libraries_Helpers_Plugins.../
Reference User Guide of CodeIgniter 1.6.1 Wikipedia PHPit Slideshare

More Related Content

What's hot (20)

PPTX
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
PPTX
Modular PHP Development using CodeIgniter Bonfire
Jeff Fox
 
PDF
Code igniter - A brief introduction
Commit University
 
PPTX
Having fun with code igniter
Ahmad Arif
 
PPTX
Introduction to MVC Web Framework with CodeIgniter
Pongsakorn U-chupala
 
PPTX
Introduction to CodeIgniter
Piti Suwannakom
 
PPTX
Codeigniter Introduction
Ashfan Ahamed
 
PDF
Progressive EPiServer Development
joelabrahamsson
 
KEY
Yii Introduction
Jason Ragsdale
 
PPTX
Mainframe, the fast PHP framework
bibakis
 
PPTX
yii1
Rajat Gupta
 
PPTX
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
PPTX
MVC - Introduction
Sudhakar Sharma
 
PPT
Getting started with angular js
Maurice De Beijer [MVP]
 
PPTX
Mvc4
Muhammad Younis
 
PPTX
MVC 6 Introduction
Sudhakar Sharma
 
PPTX
yii framework
Akhil Kumar
 
PPTX
Asp.net mvc 5 course module 1 overview
Sergey Seletsky
 
PPTX
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
PPT
Yii php framework_honey
Honeyson Joseph
 
CodeIgniter 101 Tutorial
Konstantinos Magarisiotis
 
Modular PHP Development using CodeIgniter Bonfire
Jeff Fox
 
Code igniter - A brief introduction
Commit University
 
Having fun with code igniter
Ahmad Arif
 
Introduction to MVC Web Framework with CodeIgniter
Pongsakorn U-chupala
 
Introduction to CodeIgniter
Piti Suwannakom
 
Codeigniter Introduction
Ashfan Ahamed
 
Progressive EPiServer Development
joelabrahamsson
 
Yii Introduction
Jason Ragsdale
 
Mainframe, the fast PHP framework
bibakis
 
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
MVC - Introduction
Sudhakar Sharma
 
Getting started with angular js
Maurice De Beijer [MVP]
 
MVC 6 Introduction
Sudhakar Sharma
 
yii framework
Akhil Kumar
 
Asp.net mvc 5 course module 1 overview
Sergey Seletsky
 
Beautiful REST and JSON APIs - Les Hazlewood
jaxconf
 
Yii php framework_honey
Honeyson Joseph
 

Viewers also liked (17)

ODP
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
PDF
โครงงาน Airlink เพื่อการศึกษา
พัน พัน
 
PDF
Solution Wireless Link 10 – 20 KM Speed 200 Mbps MikroTik RB SXT 5nDr2 Lite 5...
Tũi Wichets
 
PPTX
Php and database functionality
Sayed Ahmed
 
PPTX
The Hacker News: Hacking Wireless DSL routers via Admin Panel Password Reset ...
The Hacker News
 
PPT
Codeigniter Framework
Warodom Dansuwandumrong
 
DOCX
Codeigniter
Chirag Parmar
 
ODP
A Good PHP Framework For Beginners Like Me!
Muhammad Ghazali
 
PPTX
PHP Summer Training Presentation
Nitesh Sharma
 
PPT
Beginners PHP Tutorial
alexjones89
 
PPT
Php Ppt
vsnmurthy
 
PPT
MYSQL.ppt
webhostingguy
 
PDF
Introduction to MySQL
Giuseppe Maxia
 
PPT
MySQL Atchitecture and Concepts
Tuyen Vuong
 
PPS
Introduction to Mysql
Tushar Chauhan
 
PPT
Php Presentation
Manish Bothra
 
PPT
MySql slides (ppt)
webhostingguy
 
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
โครงงาน Airlink เพื่อการศึกษา
พัน พัน
 
Solution Wireless Link 10 – 20 KM Speed 200 Mbps MikroTik RB SXT 5nDr2 Lite 5...
Tũi Wichets
 
Php and database functionality
Sayed Ahmed
 
The Hacker News: Hacking Wireless DSL routers via Admin Panel Password Reset ...
The Hacker News
 
Codeigniter Framework
Warodom Dansuwandumrong
 
Codeigniter
Chirag Parmar
 
A Good PHP Framework For Beginners Like Me!
Muhammad Ghazali
 
PHP Summer Training Presentation
Nitesh Sharma
 
Beginners PHP Tutorial
alexjones89
 
Php Ppt
vsnmurthy
 
MYSQL.ppt
webhostingguy
 
Introduction to MySQL
Giuseppe Maxia
 
MySQL Atchitecture and Concepts
Tuyen Vuong
 
Introduction to Mysql
Tushar Chauhan
 
Php Presentation
Manish Bothra
 
MySql slides (ppt)
webhostingguy
 
Ad

Similar to Introduction To Code Igniter (20)

ODP
Codegnitorppt
sreedath c g
 
PPTX
Codeigniter
ShahRushika
 
PPTX
CodeIgniter & MVC
Jamshid Hashimi
 
PDF
Codeigniter
Joram Salinas
 
PPT
Codeigniter simple explanation
Arumugam P
 
PPT
Code igniter overview
umesh patil
 
PPTX
Codeignitor
Gandhi Ravi
 
PPTX
CODE IGNITER
Yesha kapadia
 
PPTX
codeigniter
Mohamed Syam
 
PDF
Intro To Mvc Development In Php
funkatron
 
PDF
Codeigniter
EmmanuelMasyenene1
 
PPTX
Codeinator
Muhammed Thanveer M
 
PPT
Getting Started with Zend Framework
Juan Antonio
 
PPTX
CodeIgniter
Sandun_Prasanna
 
PPTX
Introduction to codeigniter
Harishankaran K
 
PPTX
Codeigniter
shah baadshah
 
PPTX
Advanced php code igniter framework
Fahim Faysal Kabir
 
PDF
Codeigniter Training Part2
Weerayut Hongsa
 
Codegnitorppt
sreedath c g
 
Codeigniter
ShahRushika
 
CodeIgniter & MVC
Jamshid Hashimi
 
Codeigniter
Joram Salinas
 
Codeigniter simple explanation
Arumugam P
 
Code igniter overview
umesh patil
 
Codeignitor
Gandhi Ravi
 
CODE IGNITER
Yesha kapadia
 
codeigniter
Mohamed Syam
 
Intro To Mvc Development In Php
funkatron
 
Codeigniter
EmmanuelMasyenene1
 
Getting Started with Zend Framework
Juan Antonio
 
CodeIgniter
Sandun_Prasanna
 
Introduction to codeigniter
Harishankaran K
 
Codeigniter
shah baadshah
 
Advanced php code igniter framework
Fahim Faysal Kabir
 
Codeigniter Training Part2
Weerayut Hongsa
 
Ad

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 

Introduction To Code Igniter

  • 1. Introduction To CodeIgniter Mohammad Amzad Hossain Softwork Solutions [email_address]
  • 2. Prerequisite OOP – Object Oriented Programming PHP MySQL
  • 3. Index Introduction Evolution Of Web Development Basic Idea Of Web Framework Why Framework not Scratch? MVC ( Model View Controller) Architecture What is CodeIgniter ???? Installation of CodeIgniter Application Flow of CodeIgniter CodeIgniter URL Controllers Views Models CodeIgniter Libraries Helpers A Basic Application Development Of Codeigniter Application Flow Q/A Reference
  • 4. Evolution of Web Development How you first started building websites.
  • 5. Evolution of Web Development How you’re building websites now.
  • 6. Evolution of Web Development How you build websites with a framework
  • 7. Basic Idea Of Web Framework A web application framework Is a Software framework Designed to support the development of Dynamic websites Web applications Web services Aims to alleviate the overhead associated with common activities used in Web development. Libraries for database access Templating frameworks Session management Often promote code reuse Many more …….
  • 8. Why Framework Not Scratch ? Key Factors of a Development Interface Design Business Logic Database Manipulation User Access Control Advantage of Framework Templating 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
  • 9. MVC Architecture 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
  • 10. What is CodeIgniter ??? An Open Source Web Application Framework Nearly Zero Configuration MVC ( Model View Controller ) Architecture Multiple DB (Database) support DB Objects Templating Caching Modules Validation Rich Sets of Libraries for Commonly Needed Tasks Has a Clear, Thorough documentation
  • 11. Installation of CodeIgniter Requirments Web Server - Download & Install Apache PHP – 4.3.2 or Higher Database – MySQL ( support for other DB exists ) Installation Download the latest version from www.codeigniter.com and unzip into your web root directory. Open “application/config/config.php” and change base_url value to base url. For example: http://localhost/myci/ To Use Database open “application/config/database.php” and change necessary values. Usually you have to change: ‘hostname’, ‘username’, ‘password’, ‘datbase’. Start Your Web Server and Database Server and go to http:// localhot/myci
  • 12. Application Flow Of CodeIgniter Figure : 2 [ Application Flow of CodeIgniter]
  • 13. CodeIgniter URL URL in CodeIgniter is Segment Based. Segments in a URI CodeIgniter Optionally Supports Query String URL www.your-site.com/ news / article / my_article www.your-site.com/ class / function / ID www.your-site.com/index.php? c=news & m=article & ID=345
  • 14. Controllers A Class file resides under “application/controllers” www.your-site.com/index.php/ first <?php class First extends 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();”
  • 15. Controllers In This Particular Code <?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 !!” www.your-site.com/index.php/ first / bdosdn/ world Note: The ‘Index’ Function always loads by default. Unless there is a second segment in the URL
  • 16. VIEWS A Webpage or A page Fragment Should be placed under “application/views” Never Called Directly <html> <title> My First CodeIgniter Project</title> <body> <h1> Welcome ALL … To My .. ::: First Project ::: . . . </h1> </body> </html> web_root/myci/system/application/views/myview.php
  • 17. VIEWS Calling a VIEW from Controller Data Passing to a VIEW from Controller $this->load->view(‘myview’); 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>
  • 18. VIEWS There are 3 mechanism that can be utilize to show Dynamic Data inside a VIEW File - Pure PHP - PHP’s Alternative Syntax - CodeIgniter’s Template Engine <!-- PHP’s Alternative Syntax --> <?php if( $for_this == true ):?> <h1> For This </h1> <?php elseif( $for_that == true ): ?> <h1> For That </h1> <?php else: ?> <h1> What </h1> <?php endif; ?> Note: There are other alternative syntax ‘for’, ‘foreach’, ‘while’
  • 19. Models Designed to work with Information of Database Models Should be placed Under “application/models/” Loading a Model inside a Controller <?php class Mymodel extend Model{ function Mymodel() { parent::Model(); } function get_info () { $query = $this->db->get(‘name’, 10); /*Using ActiveRecord*/ return $query->result(); } } ?> $this->load->model(‘mymodel’); $data = $this->mymodel->get_info();
  • 20. CodeIgniter Libraries Special Purpose Classes Loading CodeIgniter Library Benchmarking Database Encryption Calendaring FTP Table File Uploading Email Image Manipulation Pagination Input and Security HTML Trackback Parser Session Template Unit Testing User Agent URI Validation $this->load->library(‘database’);
  • 21. CodeIgniter Libraries Database Library Abstract Database Class support traditional structures and Active Record Pattern. Active Record Pattern General Approach function index() { $this->load->library(‘database’); $rslt = $this->db->query (“ select first_name from user_name ”); foreach( $rslt->result() as $row_data) echo $row_data->first_name . “<br />”; } function index() { $this->load->library(‘database’); $this->db->select(“first_name”); $rslt = $this->db->get (“ user_name ”); foreach( $rslt->result() as $row_data) echo $row_data->first_name . “<br />”; }
  • 22. Helpers Simply a collection of functions in a particular category. Loading A Helper Inside a Controller Array Date File HTML Smiley Text URL Cookie Download Form Security String Directory E-mail Inflector XML Parser Typography $this->load->helper(‘helper_name’); $this->load->helper(array(‘form’,’url’) );
  • 23. Helpers Form Helper form_open() form_open_multipart() form_input() form_textarea() form_checkbox() form_submit() form_close() URL Helper site_url() base_url() anchor() anchor_popup() mailto()
  • 24. A Personal Blog Using CI
  • 25. Questions & Answers
  • 26. Useful Links www.codeigniter.com http://codeigniter.com/wiki/Summary_of_Resources_Libraries_Helpers_Plugins.../
  • 27. Reference User Guide of CodeIgniter 1.6.1 Wikipedia PHPit Slideshare