Model View Controller Bayu Priyambadha, S.Kom. PHP & MVC  The model view controller patternis the most used pattern fortoday’s world web applications.

Slides:



Advertisements
Similar presentations
PHP Array Bayu Priyambadha, S.Kom. Array Array is collection of data that is saved in some place together and it is can accessed using index key 2 Kinds.
Advertisements

What is MVC? At the very least it’s just another computer acronym…Model-View-Controller It might be new to you but it’s been around for 30 years In varying.
Bayu Priyambadha, S.Kom.  Block of script that is defined with certain name for specific job  Function is defined one time, and called many time  Function.
Presented by Benjamin Kehrer [CSCI 360, CofC, 03/17/08]
Model-View-Controller ("MVC") This is a architectural design pattern for interactive applications. This design pattern organizes an interactive application.
Multiple Tiers in Action
Tutorial -01. Objective In this session we will discuss about : 1.What is MVC? 2.Why MVC? 3.Advantages of MVC over ASP.NET 4.ASP.NET development models.
A My Name is Alice We will look at this book as writers, thinking about how the author put it together. What are some things that make this book fun to.
Struts. Agenda Preface Struts and its components An example The architecture required for Struts Applications.
UNIT-V The MVC architecture and Struts Framework.
CodeIgniter - [Overview]
MVC and MVP. References enter.html enter.html
It holds the book together. It also tells you the book’s title, author, publisher and call number.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
NOTICE! 10/1/20151 These materials are prepared only for the students enrolled in the course Distributed Software Development (DSD) at the Department of.
Lecture 19 Web Application Frameworks Boriana Koleva Room: C54
By: ___________________
Zend Framework Quick start Faheem Abbas Software engineer.
THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax.
Case Study + MVC Lec Error Pages By means of the page directive, a JSP can be given the responsibility of an Error page An Error JSP will be called.
Pemrograman Web MVC Programming and Design Pattern in PHP 5.
Some of the best books of  &mid= A23D2FC75CD A23D2FC75CD7.
MVC Design Pattern Web Developer at Crimshield, Inc Application Developer at IBM Present - Delta Developer at Tides.
JakeShop A complete application for online commerce by Jake Feasel.
Ruby on Rails By S. Christopher Hellriegel. Overview 1. What is Ruby on Rails? 2. What is MVC? 3. Simple example 4. Wow, that was cool!
Apache Struts. J2EE Web Application using MVC design pattern Why MVC? Separate components = easier maintenance – Model component holds object data – View.
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 7 1COMP9321, 15s2, Week.
CS 4720 Model-View-Controller CS 4720 – Web & Mobile Systems.
MVC WITH CODEIGNITER Presented By Bhanu Priya.
 An essential supporting structure of any thing  A Software Framework  Has layered structure ▪ What kind of functions and how they interrelate  Has.
RSS Interfaces and Standards Chander Iyer. Really Simple Syndication (RSS) Web data format providing users with frequently updated content. Make a collection.
Title Page The title page is the first page in the book. It tells you the title of the book, the author and the illustrator. It also tells you who published.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Zend Framework. What is the Zend Framework? Zend Framework is a high quality and open source framework for developing Web Applications and Web Services.
JSP / Servet (2) Bayu Priyambadha, S.Kom. MVC (Model View Controller)  Model (data logic)  Java Class (standard class, servlet, JavaBeans, or other.
SDJ INFOSOFT PVT. LTD. 2 BROWSERBROWSER JSP JavaBean DB Req Res Application Layer Enterprise server/Data Sources.
Find a Picture of Your Book Cover w/ Title of Book and Author’s Name ABC Book By (Your Name/Your Hour)
CS320 Web and Internet Programming Web Application and MVC Chengyu Sun California State University, Los Angeles.
Put title of book Here! Author and your name!. Chapter # If it has a title put it also Main Parts of the chapter- 1 paragraph summary New characters-
TECHNICAL ASSISTANCE FOR THE CONVERSION OF RBPAPs INTO RBMPs DATA MANAGEMENT INCEPTION WORKSHOP ESTAMBUL February Eusebio CRUZ GARCÍA.
BOOK REPORT 6 TH GRADE Name:Title:Author:. COVER, AUTHOR AND TITLE OF THE BOOK  Create your own cover of the book using the title and the author of the.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 9 Case Study.
Presentation Title.
Presentation Title.
COMP9321 Web Application Engineering Semester 2, 2016
Programming Club To learn about programming languages and how they can be used for fun and for useful work. What programming languages are available and.
Blanked Out Books Can you guess the book title and author from our cleverly disguised covers? Have a guess then click next to reveal the answer!
(Book Title) Our ©TEAM Book Report (Author) by (Type your names here.)
Unit 6-Chapter 2 Struts.
Presentation Title Here
Model View Controller Bayu Priyambadha, S.Kom.
REST.
Model-View-Controller (MVC) Pattern
Snowman Book Report Rubric Snowman Book Report Rubric
EXTENSION AND INTEGRATION
Group 1 Group 1 Group 1 Group 1 word word word word word word word word word word word word word word word word word word word word word word word.
TITLE Authors Institution
Software Engineering for Internet Applications
WPS - your story so far Seems incredible complicated, already
Stoke 100 Reads Reading log Name: Class:.
Model View Controller.
MAL Reading Challenge The book I read was:
Stoke Reads On Reading log Name: Class:.
For example, If this book titled "Frogs" was one of the sources you used in a research paper about frogs, then you need to give the author,
Title Introduction: Discussion & Conclusion: Methods & Results:
Title of Book By: Author’s Name
Presentation Title Your information.
Model View Controller.
Model View Controller Bayu Priyambadha, S.Kom.
Struts BY: Tejashri Udavant..
Presentation transcript:

Model View Controller Bayu Priyambadha, S.Kom

PHP & MVC  The model view controller patternis the most used pattern fortoday’s world web applications  It has been used for the first timein Smalltalk and then adopted andpopularized by Java  At present there are more than adozen PHP web frameworks based onMVC pattern

PHP & MVC  The model is responsible to manage the data  The view (presentation) is responsible to display the dataprovided by the model in a specificformat  The controller handles the model and view layers to work together

PHP & MVC

model/Book.php <?php class Book { public $title; public $author; public $description; public function __construct($title, $author, $description) { $this->title = $title; $this->author = $author; $this->description = $description; } ?>

model/Model.php <?php include_once("model/Book.php"); class Model { public function getBookList() { // here goes some hardcoded values to simulate the database return array( "Jungle Book" => new Book("Jungle Book", "R. Kipling", "A classic book."), "Moonwalker" => new Book("Moonwalker", "J. Walker", ""), "PHP for Dummies" => new Book("PHP for Dummies", "Some Smart Guy", "") ); } public function getBook($title) { // we use the previous function to get all the books // and then we return the requested one. // in a real life scenario this will be done through // a database select command $allBooks = $this->getBookList(); return $allBooks[$title]; } ?>

view/viewbook.php <?php echo 'Title:'. $book->title. ' '; echo 'Author:'. $book->author. ' '; echo 'Description:'. $book->description. ' '; ?>

view/booklist.php Title Author Description <?php foreach ($books as $book) { echo ' <a href="index.php?book='. $book->title. '">'. $book->title. ' '. $book->author. ' '. $book- >description. ' '; } ?>

controller/Controller.php <?php include_once("model/Model.php"); class Controller { public $model; public function __construct() { $this->model = new Model(); }

controller/Controller.php public function invoke() { if (!isset($_GET['book'])) { // no special book is requested, we'll show a list of all available books $books = $this->model->getBookList(); include 'view/booklist.php'; } else { // show the requested book $book = $this->model->getBook($_GET['book']); include 'view/viewbook.php'; } ?>

index.php <?php // All interaction goes through the index and is forwarded // directly to the controller include_once("controller/Controller.php"); $controller = new Controller(); $controller->invoke(); ?>

PHP & MVC