SlideShare a Scribd company logo
1 of 26
Introduction To
CodeIgniter
Prerequisite
 OOP – Object Oriented Programming
 PHP
 MySQL
Outline
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
 Apache
 PHP
 MySQL
Application Flow of CodeIgniter
 CodeIgniter URL
 Controllers
 Views
 Models
 CodeIgniter Libraries
 Helpers
Lab Work
 Getting started
 Database selection
 Html Helpers
 CRUD – Create Read Update Delete
 Pagination
 File upload
 Security
Evolution of Web Development
How you first started building websites.How you first started building websites.
Evolution of Web Development
How you’re building websites now.How you’re building websites now.
Evolution of Web Development
How you build websites with a frameworkHow you build websites with a framework
Basic Idea Of Web 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
MVC Architecture
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
 Requirements
 Web Server - Download & Install Apache
 PHP – 4.3.2 or Higher
 Database – MySQL ( support for other DB exists )
 XAMPP
Installation of CodeIgniter
 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, database.
 Start Your Web Server and Database Server and go to
http://localhot/myci
Application Flow Of CodeIgniter
Application Flow of CodeIgniter
CodeIgniter URL
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
Controllers (application/controllers)
www.your-site.com/index.php/first
<?php
class First extends Controller{
function First() {
parent::Controller();
}
function index() {
echo “<h1> Hello WORLD !! </h1> “;
}
}
?>
// Output Will be “Hello WORLD !!”
• Note:
• Class names must start with an Uppercase Letter.
• In case of “constructor” you must use “parent::Controller();”
Controllers
<?php
class First extends Controller{
function index() {
echo “<h1> Hello WORLD !! </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
18
<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
$this->load->view(‘myview’);
Data Passing to a VIEW from Controller
function index() {
$var = array(
‘full_name’ => 'Ahmad'’,
‘email’ => ‘ahmad@malaysia.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/
<?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();
CodeIgniter Libraries
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
Special Purpose Classes
$this->load->library(‘database’);
Loading CodeIgniter Library
CodeIgniter Libraries
Database Library
Abstract Database Class support traditional structures and Active Record Pattern.
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 />”;
}
Active Record Pattern
General Approach
Helpers
Simply a collection of functions in a particular category.
Array Date File HTML Smiley Text
URL Cookie Download Form Security String
Directory E-mail Inflector XML Parser Typography
$this->load->helper(‘helper_name’);
Loading A Helper Inside a Controller
$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()
Lab work

More Related Content

What's hot

Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introductionRasheed Waraich
 
Integration Testing with a Citrus twist
Integration Testing with a Citrus twistIntegration Testing with a Citrus twist
Integration Testing with a Citrus twistchristophd
 
Asp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkAsp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkShravan A
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/ServletSunil OS
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API07.pallav
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUDPrem Sanil
 
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...Edureka!
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with SpringJoshua Long
 
Web Application Development Tools for Creating Perfect User Experience
Web Application Development Tools for Creating Perfect User ExperienceWeb Application Development Tools for Creating Perfect User Experience
Web Application Development Tools for Creating Perfect User ExperienceChromeInfo Technologies
 

What's hot (20)

Spring boot jpa
Spring boot jpaSpring boot jpa
Spring boot jpa
 
Spring boot introduction
Spring boot introductionSpring boot introduction
Spring boot introduction
 
Integration Testing with a Citrus twist
Integration Testing with a Citrus twistIntegration Testing with a Citrus twist
Integration Testing with a Citrus twist
 
Asp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity FrameworkAsp.Net Core MVC with Entity Framework
Asp.Net Core MVC with Entity Framework
 
Jsp/Servlet
Jsp/ServletJsp/Servlet
Jsp/Servlet
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Spring Security 5
Spring Security 5Spring Security 5
Spring Security 5
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Socket.io (part 1)
Socket.io (part 1)Socket.io (part 1)
Socket.io (part 1)
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
Spring Framework Tutorial | Spring Tutorial For Beginners With Examples | Jav...
 
Reactjs
ReactjsReactjs
Reactjs
 
REST APIs with Spring
REST APIs with SpringREST APIs with Spring
REST APIs with Spring
 
Spring Core
Spring CoreSpring Core
Spring Core
 
PHP - Introduction to File Handling with PHP
PHP -  Introduction to  File Handling with PHPPHP -  Introduction to  File Handling with PHP
PHP - Introduction to File Handling with PHP
 
Web Application Development Tools for Creating Perfect User Experience
Web Application Development Tools for Creating Perfect User ExperienceWeb Application Development Tools for Creating Perfect User Experience
Web Application Development Tools for Creating Perfect User Experience
 
WordPress Complete Tutorial
WordPress Complete TutorialWordPress Complete Tutorial
WordPress Complete Tutorial
 

Viewers also liked

Introduction to CodeIgniter
Introduction to CodeIgniterIntroduction to CodeIgniter
Introduction to CodeIgniterPiti Suwannakom
 
Bootstrap 4 Tutorial PDF for Beginners - Learn Step by Step
Bootstrap 4 Tutorial PDF for Beginners - Learn Step by StepBootstrap 4 Tutorial PDF for Beginners - Learn Step by Step
Bootstrap 4 Tutorial PDF for Beginners - Learn Step by StepBootstrap Creative
 
Having fun with code igniter
Having fun with code igniterHaving fun with code igniter
Having fun with code igniterAhmad Arif
 
Distributed database system
Distributed database systemDistributed database system
Distributed database systemM. Ahmad Mahmood
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introductionCommit University
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code IgniterAmzad Hossain
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterPongsakorn U-chupala
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterJamshid Hashimi
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniterschwebbie
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsTuyen Vuong
 
Introduction to codeigniter
Introduction to codeigniterIntroduction to codeigniter
Introduction to codeigniterHarishankaran K
 

Viewers also liked (20)

Introduction to CodeIgniter
Introduction to CodeIgniterIntroduction to CodeIgniter
Introduction to CodeIgniter
 
Bootstrap 4 Alpha 3
Bootstrap 4 Alpha 3Bootstrap 4 Alpha 3
Bootstrap 4 Alpha 3
 
Bootstrap 4 Tutorial PDF for Beginners - Learn Step by Step
Bootstrap 4 Tutorial PDF for Beginners - Learn Step by StepBootstrap 4 Tutorial PDF for Beginners - Learn Step by Step
Bootstrap 4 Tutorial PDF for Beginners - Learn Step by Step
 
Having fun with code igniter
Having fun with code igniterHaving fun with code igniter
Having fun with code igniter
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Distributed database system
Distributed database systemDistributed database system
Distributed database system
 
Code igniter - A brief introduction
Code igniter - A brief introductionCode igniter - A brief introduction
Code igniter - A brief introduction
 
Introduction To Code Igniter
Introduction To Code IgniterIntroduction To Code Igniter
Introduction To Code Igniter
 
CodeIgniter 101 Tutorial
CodeIgniter 101 TutorialCodeIgniter 101 Tutorial
CodeIgniter 101 Tutorial
 
Introduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniterIntroduction to MVC Web Framework with CodeIgniter
Introduction to MVC Web Framework with CodeIgniter
 
PHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniterPHP Frameworks & Introduction to CodeIgniter
PHP Frameworks & Introduction to CodeIgniter
 
Introduction To CodeIgniter
Introduction To CodeIgniterIntroduction To CodeIgniter
Introduction To CodeIgniter
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
MySql slides (ppt)
MySql slides (ppt)MySql slides (ppt)
MySql slides (ppt)
 
Introduction to codeigniter
Introduction to codeigniterIntroduction to codeigniter
Introduction to codeigniter
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 

Similar to Introduction To CodeIgniter

IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET Journal
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend FrameworkJuan Antonio
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development PresentationTurnToTech
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBo-Yi Wu
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 Software
 
CodeIgniter Basics - Tutorial for Beginners
CodeIgniter Basics - Tutorial for Beginners CodeIgniter Basics - Tutorial for Beginners
CodeIgniter Basics - Tutorial for Beginners Isuru Thilakarathne
 
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Amazon Web Services
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET PresentationRasel Khan
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applicationshchen1
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101Rich Helton
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Railscodeinmotion
 
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
Ch10 Hacking Web Servers http://ouo.io/2Bt7XCh10 Hacking Web Servers http://ouo.io/2Bt7X
Ch10 Hacking Web Servers http://ouo.io/2Bt7Xphanleson
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handsonPrashant Kumar
 

Similar to Introduction To CodeIgniter (20)

Codeigniter
CodeigniterCodeigniter
Codeigniter
 
CODE IGNITER
CODE IGNITERCODE IGNITER
CODE IGNITER
 
Codegnitorppt
CodegnitorpptCodegnitorppt
Codegnitorppt
 
IRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHPIRJET- Lightweight MVC Framework in PHP
IRJET- Lightweight MVC Framework in PHP
 
Getting Started with Zend Framework
Getting Started with Zend FrameworkGetting Started with Zend Framework
Getting Started with Zend Framework
 
Web Development Presentation
Web Development PresentationWeb Development Presentation
Web Development Presentation
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
 
Folio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP YiiFolio3 - An Introduction to PHP Yii
Folio3 - An Introduction to PHP Yii
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
CodeIgniter Basics - Tutorial for Beginners
CodeIgniter Basics - Tutorial for Beginners CodeIgniter Basics - Tutorial for Beginners
CodeIgniter Basics - Tutorial for Beginners
 
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
Expedite the development lifecycle with MongoDB and serverless - DEM02 - Sant...
 
CodeIgniter
CodeIgniterCodeIgniter
CodeIgniter
 
ASP.NET Presentation
ASP.NET PresentationASP.NET Presentation
ASP.NET Presentation
 
codeigniter
codeignitercodeigniter
codeigniter
 
Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Codeignitor
Codeignitor Codeignitor
Codeignitor
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
MVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on RailsMVC Demystified: Essence of Ruby on Rails
MVC Demystified: Essence of Ruby on Rails
 
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
Ch10 Hacking Web Servers http://ouo.io/2Bt7XCh10 Hacking Web Servers http://ouo.io/2Bt7X
Ch10 Hacking Web Servers http://ouo.io/2Bt7X
 
Asp.net With mvc handson
Asp.net With mvc handsonAsp.net With mvc handson
Asp.net With mvc handson
 

More from Muhammad Hafiz Hasan

More from Muhammad Hafiz Hasan (6)

ElePHPant7 - Introduction to PHP7
ElePHPant7 - Introduction to PHP7ElePHPant7 - Introduction to PHP7
ElePHPant7 - Introduction to PHP7
 
Introduction to Eclipse IDE
Introduction to Eclipse IDEIntroduction to Eclipse IDE
Introduction to Eclipse IDE
 
Introduction to CVS
Introduction to CVSIntroduction to CVS
Introduction to CVS
 
Introduction to Apache Ant
Introduction to Apache AntIntroduction to Apache Ant
Introduction to Apache Ant
 
Board presentation
Board presentationBoard presentation
Board presentation
 
Good design
Good designGood design
Good design
 

Recently uploaded

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 

Recently uploaded (20)

Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 

Introduction To CodeIgniter

  • 2. Prerequisite  OOP – Object Oriented Programming  PHP  MySQL
  • 3. Outline 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  Apache  PHP  MySQL Application Flow of CodeIgniter  CodeIgniter URL  Controllers  Views  Models  CodeIgniter Libraries  Helpers Lab Work  Getting started  Database selection  Html Helpers  CRUD – Create Read Update Delete  Pagination  File upload  Security
  • 4. Evolution of Web Development How you first started building websites.How you first started building websites.
  • 5. Evolution of Web Development How you’re building websites now.How you’re building websites now.
  • 6. Evolution of Web Development How you build websites with a frameworkHow you build websites with a framework
  • 7. Basic Idea Of Web 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
  • 11. 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
  • 12. Installation of CodeIgniter  Requirements  Web Server - Download & Install Apache  PHP – 4.3.2 or Higher  Database – MySQL ( support for other DB exists )  XAMPP
  • 13. Installation of CodeIgniter  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, database.  Start Your Web Server and Database Server and go to http://localhot/myci
  • 14. Application Flow Of CodeIgniter Application Flow of CodeIgniter
  • 15. CodeIgniter URL 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
  • 16. Controllers (application/controllers) www.your-site.com/index.php/first <?php class First extends Controller{ function First() { parent::Controller(); } function index() { echo “<h1> Hello WORLD !! </h1> “; } } ?> // Output Will be “Hello WORLD !!” • Note: • Class names must start with an Uppercase Letter. • In case of “constructor” you must use “parent::Controller();”
  • 17. Controllers <?php class First extends Controller{ function index() { echo “<h1> Hello WORLD !! </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
  • 18. VIEWS  A Webpage or A page Fragment  Should be placed under application/views  Never Called Directly 18 <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
  • 19. VIEWS Calling a VIEW from Controller $this->load->view(‘myview’); Data Passing to a VIEW from Controller function index() { $var = array( ‘full_name’ => 'Ahmad'’, ‘email’ => ‘ahmad@malaysia.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>
  • 20. 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’
  • 21. Models 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();
  • 22. CodeIgniter Libraries 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 Special Purpose Classes $this->load->library(‘database’); Loading CodeIgniter Library
  • 23. CodeIgniter Libraries Database Library Abstract Database Class support traditional structures and Active Record Pattern. 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 />”; } Active Record Pattern General Approach
  • 24. Helpers Simply a collection of functions in a particular category. Array Date File HTML Smiley Text URL Cookie Download Form Security String Directory E-mail Inflector XML Parser Typography $this->load->helper(‘helper_name’); Loading A Helper Inside a Controller $this->load->helper(array(‘form’,’url’) );
  • 25. 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()