Home arrow PHP arrow Dealing with Views in an MVC-based Framework in PHP 5

Dealing with Views in an MVC-based Framework in PHP 5

In this eighth part of the series, I add to our example MVC-based framework another crucial component. In this case, it's a class that parses data usually injected from a controller and rendered in the form of HTML pages.

  1. Dealing with Views in an MVC-based Framework in PHP 5
  2. Review: adding caching capabilities to the sample framework
  3. Developing a view-handling class
  4. Adding a method for parsing data
By: Alejandro Gervasio
Rating: starstarstarstarstar / 5
June 23, 2010

print this article



As you may know, the Model-View-Controller design pattern has become one of the most widely-adopted standards for developing web programs that maintain application and business logic isolated from visual presentation.

This structural pattern has gained remarkable popularity, especially with PHP developers who already have a firm background in using design patterns for building well-structured and scalable web applications. However, for those who are just learning this specific area, implementing the MVC paradigm in a real-world project can be a pretty challenging task.

In reality, using the MVC pattern with PHP 5 is much easier than you may think. To prove that, in the course of this series of articles Iím going to walk you through the development of a extensible framework that will follow the schema dictated by the pattern.

The purpose for doing this isnít reinventing anything at all. Instead, you should consider this an educational experience that hopefully will arm you with a more solid understanding of the basics of the MVC pattern and its implementation in a concrete case.

However, if youíve read the previous tutorials to this point, then itís safe to say that youíre familiar with the construction of the sample MVC framework mentioned above. In those tutorials I added a set of loosely-coupled classes, aimed at tackling some common tasks such as routing and dispatching user requests to the appropriate controllers and dynamically generating web forms, as well as filtering user input and caching data.

With that decent number of classes available for immediate use, it could be said that the functionality of the framework is fairly acceptable. Or could it? Since the framework will implement an MVC layer, itís mandatory to create a brand new class that permits you to create and handle views in a painless fashion.

Thatís exactly what Iím going to do in the following lines. So, to learn the full details of this process, jump in and start reading!

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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- 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: