introduction to mvc web framework with codeigniter

27
By @KnightBaron INTRODUCTION TO MVC WEB FRAMEWORK WITH CODEIGNITER

Upload: pongsakorn-u-chupala

Post on 20-Aug-2015

7.285 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Introduction to MVC Web Framework with CodeIgniter

By @KnightBaron

INTRODUCTION TO MVC WEB FRAMEWORK WITH CODEIGNITER

Page 2: Introduction to MVC Web Framework with CodeIgniter

WHAT IS FRAMEWORK?

Page 3: Introduction to MVC Web Framework with CodeIgniter

WHAT IS FRAMEWORK?

Provide general structure of the application

Therefore, you must learn its structure to be able to use it

Handle common tasks

What is a difference between framework and library?

Your code use library

Your code is used by framework

Page 4: Introduction to MVC Web Framework with CodeIgniter

WHAT IS MVC?

Page 5: Introduction to MVC Web Framework with CodeIgniter

WHAT IS MVC?

A Design Pattern

Stands for Model, View and Controller

Separate Business Logic from Presentation Logic

Page 6: Introduction to MVC Web Framework with CodeIgniter

MODEL-VIEW-CONTROLLER

Model

ViewController

Page 7: Introduction to MVC Web Framework with CodeIgniter

MODEL

Represents data

Hold data structure

Usually (but not always) backed by database

Contains data related logic

i.e. determine whether today is user birthday or not

Page 8: Introduction to MVC Web Framework with CodeIgniter

CONTROLLER

Holds business logic

Handling Input/Output

Notify model(s) of user action

Use view(s) for presentation

Page 9: Introduction to MVC Web Framework with CodeIgniter

VIEW

How data will be displayed to user

Holds presentation logic

i.e. looping through a set of data to be displayed

Page 10: Introduction to MVC Web Framework with CodeIgniter

MVC AND THE WEB

Page 11: Introduction to MVC Web Framework with CodeIgniter

MVC FOR WEB

Page 12: Introduction to MVC Web Framework with CodeIgniter

MVC WEB FRAMEWORK

Ruby

• Ruby on Rails

• Merb• Etc.

Python

• Django• Pylons• TurboGears• Etc.

PHP

• CodeIgniter• CakePHP• Zend

Framework• Etc.

Page 13: Introduction to MVC Web Framework with CodeIgniter

INTRODUCTION TO CODEIGNITER

Page 14: Introduction to MVC Web Framework with CodeIgniter

WHY CODEIGNITER?

Pros

Easy to learn and adopt

Easy to deploy

Lightweight

Extensive Thai user base

Thai document is available

http://codeigniter.in.th by @Dominixz

Cons

It’s PHP :-(

Not very object-oriented in some part

Incompetence cache and view framework

Though you can plug another toolset of your choice instead

Page 15: Introduction to MVC Web Framework with CodeIgniter

WANT A BETTER EXPERIENCE?

Page 16: Introduction to MVC Web Framework with CodeIgniter

A STANDARD BLOG EXAMPLE

Page 17: Introduction to MVC Web Framework with CodeIgniter

WHAT DO WE NEED FOR A BLOG?

Page 18: Introduction to MVC Web Framework with CodeIgniter

COMPONENTS OF A BLOG

Post (Entry)

(Static) Page Category

Comment Theme Tag

User Navigation Etc.

Page 19: Introduction to MVC Web Framework with CodeIgniter

A (STUPIDLY) SIMPLE BLOG

Post

Comment

Front Page

Post Page

Create New Post Page

Page 20: Introduction to MVC Web Framework with CodeIgniter

A (STUPIDLY) SIMPLE BLOG BROKEN INTO MVC

Model

• Post• Comment

Controller

• Blog

View

• Front View

• Post View• Create

New Post View

Page 21: Introduction to MVC Web Framework with CodeIgniter

WORKSHOP: CREATING A BLOG WITH CODEIGNITER

Page 22: Introduction to MVC Web Framework with CodeIgniter

CONCLUSION

Page 23: Introduction to MVC Web Framework with CodeIgniter

CONCLUSION

What is a framework?

What is MVC?

Model – Represents data

Controller – Holds business logic

View – Holds presentation logic

MVC In Web Application

Implementing a blog with CodeIgniter

Page 24: Introduction to MVC Web Framework with CodeIgniter

ANY QUESTION?

Page 25: Introduction to MVC Web Framework with CodeIgniter

THANK YOU

Feel free to

contact me for

any help

Page 27: Introduction to MVC Web Framework with CodeIgniter

CONTACT ME

Blog: http://aosekai.net

Email: knightbaron (at) gmail (dot) com

Twitter: @KnightBaron

Facebook: http://fb.me/knightbaron

IRC

#[email protected]

#[email protected]