Home arrow PHP arrow Generating View from MySQL to Simulate the Model-View-Controller Schema in PHP

Generating View from MySQL to Simulate the Model-View-Controller Schema in PHP

Are you a curious PHP developer, wanting to learn how to simulate a basic Model-View-Controller schema with PHP? Then, look no further, because you’re in the right place. Welcome to the final part of the series “Simulating the Model-View-Controller Schema in PHP.” In three tutorials, this series provides you with a comprehensive introduction, aimed at implementing a MVC-based relationship between PHP objects.

TABLE OF CONTENTS:
  1. Generating View from MySQL to Simulate the Model-View-Controller Schema in PHP
  2. The starting point of a brand new MVC schema: defining some MySQL processing classes
  3. Setting up the basics for generating disparate views: defining a controller based on MySQL datasets
  4. Defining the next link of the chain: creating a model founded on native MySQL data sets
  5. Generating distinct views from a single MySQL result set: creating an output generator class
  6. Putting the classes to work together: seeing the MVC schema in action
By: Alejandro Gervasio
Rating: starstarstarstarstar / 14
August 21, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Introduction

If you've been one of those readers who has followed the first two installments of this series, then it's highly probably that you know how to define a specific interaction between several objects, which behave separately as a Model, a View and finally a Controller respectively (hence the name MVC).

As you'll possibly recall, over the previous articles I walked you through a couple of hands-on examples to demonstrate how to implement easily the MVC schema with PHP (at least a very basic one). I showed you a basic case that illustrated how to define this type of relationship between a few simplistic message handling classes.

Also, in order to move the schema in question much closer to a real situation, in the second article I developed a quite useful web page generating system, which was capable of attaching on the fly different style sheets, according to the instructions passed by a generic controller object.

Of course, from the very beginning, the goal of this series was to demonstrate how to integrate the MVC schema in PHP. If, however, you're expecting to see something similar to the mechanism implemented in Ruby-on-Rails, then I recommend that you read specific material related to that language and its framework. That is beyond the scope of these articles. 

All right, after refreshing the topics covered previously, as well as clarifying some key concepts with reference to the concrete subject of this series, this journey will continue by constructing yet another practical example to expand your overall knowledge of object-based programming with PHP. In particular, it's designed to show you to use a MVC-driven relationship in another real-world situation.

If you're wondering to what other cases this relationship can be specifically applied, then I have good news for you. In this final article, I'll show you how to implement the MVC schema, in order to generate different outputs (or views) from a given MySQL data set.

I'm pretty sure that this experience will be appealing to you, therefore let's see together how this can be achieved with PHP. Let's get started!



 
 
>>> More PHP Articles          >>> More By Alejandro Gervasio
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: