Tag Archives: views

Model-View-Controller in PHP: View

I’ve been programming in PHP for a few years now, and after being exposed to MVC through Ruby on Rails back in 2007, I came to realize that I liked the idea of keeping the presentation of data separate from the manipulation of data.

So I built a View class.  Download View Class

Usage:

$view = new View('views/main_page.tpl', array(
       'some_var' => 'This will be assigned to $some_var in the view'));
$view->render();

And like that, data presentation is separated from data manipulation.

Piece of cake.