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


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

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

Piece of cake.

2 thoughts on “Model-View-Controller in PHP: View

  1. Kate Baker

    Hey Mike,

    I found your blog! It looks good.

    Business related query: My parents would like to set up a fancy spanking new website for the B&B, and asked me if I knew any creative “starving students” who would like a little side project for some cash. You’re my first pick. There’s lots of time to do it, so if you are busy with midterms etc. for the next while we can wait. Let me know if you’d be interested!

    – Kate

Comments are closed.