SlideShare a Scribd company logo
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 Introduction
Ashfan Ahamed
 
PHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniterPHP Frameworks and CodeIgniter
PHP Frameworks and CodeIgniter
KHALID C
 
Yii2 by Peter Jack Kambey
Yii2 by Peter Jack KambeyYii2 by Peter Jack Kambey
Yii2 by Peter Jack Kambey
k4ndar
 
Progressive EPiServer Development
Progressive EPiServer DevelopmentProgressive EPiServer Development
Progressive EPiServer Development
joelabrahamsson
 
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
Andy 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 Hazlewood
jaxconf
 
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 2
Cassiano 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 & Keycloak
Charles Moulliard
 
What is an API?
What is an API?What is an API?
What is an API?
Muhammad Zuhdi
 
Mule groovy
Mule groovyMule groovy
Mule groovy
Sindhu VL
 
Introduction Yii Framework
Introduction Yii FrameworkIntroduction Yii Framework
Introduction Yii Framework
Tuan Nguyen
 
Web api
Web apiWeb api
ASP .NET MVC
ASP .NET MVC ASP .NET MVC
ASP .NET MVC eldorina
 
MVC 6 Introduction
MVC 6 IntroductionMVC 6 Introduction
MVC 6 Introduction
Sudhakar Sharma
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
Noam 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 - VS2015
Hossein 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

Codeigniter
CodeigniterCodeigniter
Codeigniter
Chirag Parmar
 
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 Framework
Bo-Yi Wu
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
Giuseppe Maxia
 
MySQL Atchitecture and Concepts
MySQL Atchitecture and ConceptsMySQL Atchitecture and Concepts
MySQL Atchitecture and Concepts
Tuyen Vuong
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
Tushar Chauhan
 
Introduction to codeigniter
Introduction to codeigniterIntroduction to codeigniter
Introduction to codeigniter
Harishankaran K
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
Pongsakorn U-chupala
 

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

My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
Arjun Kumawat
 
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 boss
Francisco 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
 
Codeignitor
Codeignitor Codeignitor
Codeignitor
Gandhi Ravi
 
In Act Developers Platform
In Act Developers PlatformIn Act Developers Platform
In Act Developers PlatformEris Ristemena
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
ShahRushika
 
Vijay Oscon
Vijay OsconVijay Oscon
Vijay Oscon
vijayrvr
 
flask.pptx
flask.pptxflask.pptx
flask.pptx
asif290119
 
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
 
Elefrant [ng-Poznan]
Elefrant [ng-Poznan]Elefrant [ng-Poznan]
Elefrant [ng-Poznan]
Marcos Latorre
 
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
 
Dot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDFDot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDF
Scholarhat
 
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 migrare
Andrea Campaci
 

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
 
Dot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDFDot NET Solution Architect Roadmap By Scholarhat PDF
Dot NET Solution Architect Roadmap By Scholarhat PDF
 
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
 

Recently uploaded

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 

Recently uploaded (20)

1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 

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