SlideShare a Scribd company logo
1 of 27
Have fun with
CodeIgniter Framework
23 April 2016
& Ahmad Arif
About Me
 Pendidikan
 1998-2004 SDN 1 Kertamulya, Karawang
 2004-2007 SMPN 2 Rengasdengklok, Karawang
 2007-2010 SMAN 1 Rengasdengklok, Karawang
 2010-2014 Informatika Universitas Jenderal Achman Yani
 2015-???? Informatika Institut Teknologi Bandung
 Minat
 Programming
 Machine Learning
 Artificial Intelligent
 Game Technology
 Entertainment
 Etc
What is framework?
 Framework = Kerangka kerja
 Menyediakan struktur umum aplikasi sehingga
memudahkan pengembang dalam menyimpan kode
dalam aplikasi
 Menangani tugas umum
– Database
– Business logic
– Form handling
What is CodeIgniter?
 CodeIgniter framework aplikasi web ringan yang ditulis
dalam bahasa pemrograman PHP, dan mengadopsi
pendekatan Model-View-Controller.
Kenapa menggunakan CodeIgniter?
 Feature rich
 Lightweight/small
 Open source
 Well-supported by an active community
 Excellent “by example” documentation
 Easy to configure (nearly zero configuration)
 Supports multiple databases
 Cleaner code
 High Performance
https://github.com/kenjis/php-framework-benchmark
Model-View-Controller
 Model – merepresentasikan data
 View – menyajikan data untuk interaksi dengan user
 Controller – mengontrol model dan data supaya bisa
saling berinteraksi
CodeIgniter Classes
 CI’s built-in classes berisi fungsi dasar yang sering
digunakan oleh aplikasi web
 Beberapa kelas yang sering digunakan:
– Database
– Input
– Loader
– URI
– Validation
Database Class
 Mengolah queri menggunakan the Active Record / ORM
Pattern
 Menyediakan metode “chaining” untuk kemudahan query
 $this->db->where(‘name’,$name);
Input Class
 Menyediakan akses ke input pengguna dan data lainnya:
– Form fields (POST)
– Cookies
– Server variables
 $this->input->post(‘fieldname’);
Loader Class
 Membuat berbagai resource:
– Databases
– Views
– Helpers
– Plugins
 $this->load->view(‘viewname’);
URI Class
 Menyediakan akses ke bagian-bagian tertentu dari String
URI
 Berguna untuk membangung RESTful API
 $this->uri->segment(n);
Other Classes
 Benchmarking
 Calendaring
 Email
 Encryption
 File uploading
 FTP
 HTML Table
 Image Manipulation
 Language
(internationalization)
 Output
 Pagination
 Session
 Trackback
 Unit testing
 XML-RPC
 Zip encoding
Helpers and Plugins
 CodeIgniter dilengkapi dengan berbagai “helper” yaitu
fungsi yang menambahkan kenyamanan terhadap
aplikasi dan memberikan kemudahan reuse code.
 $this->load->helper(‘helper_name’);
 CodeIgniter juga memungkinkan untuk penggunaan
kustom add-on yang disebut “plugins”.
 $this->load->plugin(‘plugin_name’);
Getting Started
 Tools
– Apache HTTP Server
– MySQL Database
– PHP
– Browser
– Code Editor
XAMP, WAMP, MAMP, LAMPP
 Notepad
 Notepad++
 Sublime
 Atom
 PHP Storm
 Etc
Getting Started
 To Do List
– Installation
– Controller
– View
– Model
– RESTful API
Controller
<?php
class BlogController extends CI_Controller {
public function index() {
echo 'Hello World!';
}
public function comments() {
echo 'Look at this!';
}
}
<?php
class BlogController extends CI_Controller {
…
public function page($index) {
echo 'Page: !' . $index;
}
}
View
<html>
<head>
<title>My Blog</title>
</head>
<body>
<h1>Welcome to my Blog!<h1>
</body>
</html>
index.php
$this->load->view(“index”);
Add this code in controller
View
<html>
<head>
<title>My Blog</title>
</head>
<body>
Welcome <strong><?php echo $name ?><strong>
</body>
</html>
index.php
$data = array(
“name” => “Ahmad Arif”
);
$this->load->view(“index”, $data);
Add this code in controller
Model
 Create database and table
 Setting database (config/database.php)
Model
class Blog extends CI_Model {
$tableName = “blog”;
public function insert($title, $content){
$data = array(
“title” => $title,
“content” => $content
);
$this->db->insert($this->tableName, $data);
}
}
Model
class Blog extends CI_Model {
...
public function update($id, $title, $content){
$data = array(
“title” => $title,
“content” => $content
);
$this->db->where(“id”, $id);
$this->db->update($this->tableName, $data);
}
}
Model
class Blog extends CI_Model {
...
public function delete($id){
$this->db->where(“id”, $id);
$this->db->delete($this->tableName);
}
}
Model
class Blog extends CI_Model {
...
public function getAll(){
return $this->db->get($this->tableName)->result();
}
public function getById($id){
$this->db->where(“id”, $id);
return $this->db->get($this->tableName)->row();
}
}
Using Model
class BlogController extends CI_Controller {
...
public function insert(){
$this->load->model(“Blog”);
$title = $this->input->post(“title”);
$content = $this->input->post(“content”);
$this->Blog->insert($title, $content);
}
}
RESTful API
 Tools
– Postman
– Code Editor
 To Do List
– Format JSON/XML
– Routing
– Cache setting
References
 https://codeigniter.com
 https://google.com
 https://github.com/ahmadarif
Tank You

More Related Content

What's hot

Codeigniter Introduction
Codeigniter IntroductionCodeigniter Introduction
Codeigniter IntroductionAshfan Ahamed
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterKHALID C
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambeyk4ndar
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Developmentjoelabrahamsson
 
A site in 15 minutes with yii
A site in 15 minutes with yiiA site in 15 minutes with yii
A site in 15 minutes with yiiAndy Kelk
 
Beautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les HazlewoodBeautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les Hazlewoodjaxconf
 
Automated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS SitesAutomated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS Sitesjoelabrahamsson
 
Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2Cassiano Surek
 
Security enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & KeycloakSecurity enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & KeycloakCharles Moulliard
 
Introduction Yii Framework
Introduction Yii FrameworkIntroduction Yii Framework
Introduction Yii FrameworkTuan Nguyen
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Noam Kfir
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015Hossein Zahed
 

What's hot (20)

Codeigniter Introduction
Codeigniter IntroductionCodeigniter Introduction
Codeigniter Introduction
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
 
yii1
yii1yii1
yii1
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambey
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Development
 
A site in 15 minutes with yii
A site in 15 minutes with yiiA site in 15 minutes with yii
A site in 15 minutes with yii
 
Beautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les HazlewoodBeautiful REST and JSON APIs - Les Hazlewood
Beautiful REST and JSON APIs - Les Hazlewood
 
Automated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS SitesAutomated Testing Of EPiServer CMS Sites
Automated Testing Of EPiServer CMS Sites
 
Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2Yii 2.0 overview - 1 of 2
Yii 2.0 overview - 1 of 2
 
Security enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & KeycloakSecurity enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & Keycloak
 
MVC - Introduction
MVC - IntroductionMVC - Introduction
MVC - Introduction
 
What is an API?
What is an API?What is an API?
What is an API?
 
Mule groovy
Mule groovyMule groovy
Mule groovy
 
Introduction Yii Framework
Introduction Yii FrameworkIntroduction Yii Framework
Introduction Yii Framework
 
Api presentation
Api presentationApi presentation
Api presentation
 
Web api
Web apiWeb api
Web api
 
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
 
ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015ASP.NET MVC 5 - EF 6 - VS2015
ASP.NET MVC 5 - EF 6 - VS2015
 

Viewers also liked

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
 
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 (11)

Codeigniter
CodeigniterCodeigniter
Codeigniter
 
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
 
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 Having fun with code igniter

AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )senthil0809
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBo-Yi Wu
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a bossFrancisco Ribeiro
 
Dog food conference creating modular webparts with require js in sharepoint
Dog food conference   creating modular webparts with require js in sharepointDog food conference   creating modular webparts with require js in sharepoint
Dog food conference creating modular webparts with require js in sharepointfahey252
 
In Act Developers Platform
In Act Developers PlatformIn Act Developers Platform
In Act Developers PlatformEris Ristemena
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Osconvijayrvr
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)Tom Johnson
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Tom Johnson
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Bastian Feder
 
Online Fitness Gym Documentation
Online Fitness Gym Documentation Online Fitness Gym Documentation
Online Fitness Gym Documentation Abhishek Patel
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introductionvstorm83
 
Vue3: nuove funzionalità, differenze e come migrare
Vue3: nuove funzionalità, differenze e come migrareVue3: nuove funzionalità, differenze e come migrare
Vue3: nuove funzionalità, differenze e come migrareAndrea Campaci
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CIMartin de Keijzer
 

Similar to Having fun with code igniter (20)

My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )AIR - Framework ( Cairngorm and Parsley )
AIR - Framework ( Cairngorm and Parsley )
 
Benefit of CodeIgniter php framework
Benefit of CodeIgniter php frameworkBenefit of CodeIgniter php framework
Benefit of CodeIgniter php framework
 
web2py:Web development like a boss
web2py:Web development like a bossweb2py:Web development like a boss
web2py:Web development like a boss
 
Dog food conference creating modular webparts with require js in sharepoint
Dog food conference   creating modular webparts with require js in sharepointDog food conference   creating modular webparts with require js in sharepoint
Dog food conference creating modular webparts with require js in sharepoint
 
Codeignitor
Codeignitor Codeignitor
Codeignitor
 
In Act Developers Platform
In Act Developers PlatformIn Act Developers Platform
In Act Developers Platform
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
 
flask.pptx
flask.pptxflask.pptx
flask.pptx
 
API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)API workshop: Introduction to APIs (TC Camp)
API workshop: Introduction to APIs (TC Camp)
 
Elefrant [ng-Poznan]
Elefrant [ng-Poznan]Elefrant [ng-Poznan]
Elefrant [ng-Poznan]
 
Ide
IdeIde
Ide
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Online Fitness Gym Documentation
Online Fitness Gym Documentation Online Fitness Gym Documentation
Online Fitness Gym Documentation
 
eXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework IntroductioneXo Platform SEA - Play Framework Introduction
eXo Platform SEA - Play Framework Introduction
 
Vue3: nuove funzionalità, differenze e come migrare
Vue3: nuove funzionalità, differenze e come migrareVue3: nuove funzionalità, differenze e come migrare
Vue3: nuove funzionalità, differenze e come migrare
 
Improving code quality using CI
Improving code quality using CIImproving code quality using CI
Improving code quality using CI
 

Recently uploaded

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 

Having fun with code igniter

  • 1. Have fun with CodeIgniter Framework 23 April 2016 & Ahmad Arif
  • 2. About Me  Pendidikan  1998-2004 SDN 1 Kertamulya, Karawang  2004-2007 SMPN 2 Rengasdengklok, Karawang  2007-2010 SMAN 1 Rengasdengklok, Karawang  2010-2014 Informatika Universitas Jenderal Achman Yani  2015-???? Informatika Institut Teknologi Bandung  Minat  Programming  Machine Learning  Artificial Intelligent  Game Technology  Entertainment  Etc
  • 3. What is framework?  Framework = Kerangka kerja  Menyediakan struktur umum aplikasi sehingga memudahkan pengembang dalam menyimpan kode dalam aplikasi  Menangani tugas umum – Database – Business logic – Form handling
  • 4. What is CodeIgniter?  CodeIgniter framework aplikasi web ringan yang ditulis dalam bahasa pemrograman PHP, dan mengadopsi pendekatan Model-View-Controller.
  • 5. Kenapa menggunakan CodeIgniter?  Feature rich  Lightweight/small  Open source  Well-supported by an active community  Excellent “by example” documentation  Easy to configure (nearly zero configuration)  Supports multiple databases  Cleaner code  High Performance https://github.com/kenjis/php-framework-benchmark
  • 6. Model-View-Controller  Model – merepresentasikan data  View – menyajikan data untuk interaksi dengan user  Controller – mengontrol model dan data supaya bisa saling berinteraksi
  • 7. CodeIgniter Classes  CI’s built-in classes berisi fungsi dasar yang sering digunakan oleh aplikasi web  Beberapa kelas yang sering digunakan: – Database – Input – Loader – URI – Validation
  • 8. Database Class  Mengolah queri menggunakan the Active Record / ORM Pattern  Menyediakan metode “chaining” untuk kemudahan query  $this->db->where(‘name’,$name);
  • 9. Input Class  Menyediakan akses ke input pengguna dan data lainnya: – Form fields (POST) – Cookies – Server variables  $this->input->post(‘fieldname’);
  • 10. Loader Class  Membuat berbagai resource: – Databases – Views – Helpers – Plugins  $this->load->view(‘viewname’);
  • 11. URI Class  Menyediakan akses ke bagian-bagian tertentu dari String URI  Berguna untuk membangung RESTful API  $this->uri->segment(n);
  • 12. Other Classes  Benchmarking  Calendaring  Email  Encryption  File uploading  FTP  HTML Table  Image Manipulation  Language (internationalization)  Output  Pagination  Session  Trackback  Unit testing  XML-RPC  Zip encoding
  • 13. Helpers and Plugins  CodeIgniter dilengkapi dengan berbagai “helper” yaitu fungsi yang menambahkan kenyamanan terhadap aplikasi dan memberikan kemudahan reuse code.  $this->load->helper(‘helper_name’);  CodeIgniter juga memungkinkan untuk penggunaan kustom add-on yang disebut “plugins”.  $this->load->plugin(‘plugin_name’);
  • 14. Getting Started  Tools – Apache HTTP Server – MySQL Database – PHP – Browser – Code Editor XAMP, WAMP, MAMP, LAMPP  Notepad  Notepad++  Sublime  Atom  PHP Storm  Etc
  • 15. Getting Started  To Do List – Installation – Controller – View – Model – RESTful API
  • 16. Controller <?php class BlogController extends CI_Controller { public function index() { echo 'Hello World!'; } public function comments() { echo 'Look at this!'; } } <?php class BlogController extends CI_Controller { … public function page($index) { echo 'Page: !' . $index; } }
  • 17. View <html> <head> <title>My Blog</title> </head> <body> <h1>Welcome to my Blog!<h1> </body> </html> index.php $this->load->view(“index”); Add this code in controller
  • 18. View <html> <head> <title>My Blog</title> </head> <body> Welcome <strong><?php echo $name ?><strong> </body> </html> index.php $data = array( “name” => “Ahmad Arif” ); $this->load->view(“index”, $data); Add this code in controller
  • 19. Model  Create database and table  Setting database (config/database.php)
  • 20. Model class Blog extends CI_Model { $tableName = “blog”; public function insert($title, $content){ $data = array( “title” => $title, “content” => $content ); $this->db->insert($this->tableName, $data); } }
  • 21. Model class Blog extends CI_Model { ... public function update($id, $title, $content){ $data = array( “title” => $title, “content” => $content ); $this->db->where(“id”, $id); $this->db->update($this->tableName, $data); } }
  • 22. Model class Blog extends CI_Model { ... public function delete($id){ $this->db->where(“id”, $id); $this->db->delete($this->tableName); } }
  • 23. Model class Blog extends CI_Model { ... public function getAll(){ return $this->db->get($this->tableName)->result(); } public function getById($id){ $this->db->where(“id”, $id); return $this->db->get($this->tableName)->row(); } }
  • 24. Using Model class BlogController extends CI_Controller { ... public function insert(){ $this->load->model(“Blog”); $title = $this->input->post(“title”); $content = $this->input->post(“content”); $this->Blog->insert($title, $content); } }
  • 25. RESTful API  Tools – Postman – Code Editor  To Do List – Format JSON/XML – Routing – Cache setting

Editor's Notes

  1. Chain = rantai