PHP, Frameworks, MVC, and the rest → FIND ←

Tuesday, 4 January 2011 12:34 am
tags: coding php

I've been rather busy the last couple of months having a go at building my own PHP CMS, modelled on the MVC design pattern. At work, I'm currently using a rather large, feature-stuffed home-baked CMS, brewed in-house by our PHP freelancer. Learning the ins and outs of this system over the past 6 months has inspired me to have a go at building my own. Two months later and, well, I'm still working on it. But I like to think it's certainly getting there.

MVC - or Model View Controller, is a design pattern which encourages the separation of logic and markup. It's very popular amongst web applications and there are numerous frameworks out there that implement their own take on the MVC pattern. The idea of a CMS is not foreign to me, in fact this very blog is built on a rudimentary procedural-style CMS. However, I was interested in the MVC style of application and wanted to explore how it could be used to create a functional CMS. The main feature of the MVC approach, is all your deep application logic and inner-workings (PHP, MySQL, XML, etc.) can be kept completely separate to the display elements of the website (HTML, CSS, javascript, etc.). This cuts down on code re-use significantly, promotes good organisation and above all, provides a clear and succinct view for the designers to work on.

I've always had a nasty habit of reinventing the wheel when it comes to coding, or creative things in general in fact; I have to know how something works before I feel comfortable using it. Having been coding PHP for many years, and dabbling in some more advanced object-oriented stuff - especially at work - I thought it would be a good idea to try making my own system. I wouldn't even want to guess how many hours I've put into it so far, but I'm still plugging away it and I'm proud of what I've got so far. I imagine it's the sort of project where I will be constantly making refinements and improvements in the future.

This all started I suppose when a friend of mine, and skilled artist, Thomas Fox came to me enquiring about a redesign for his Art portfolio. I jumped on it, banged out a few designs, but then got rather excited about the prospect of making a small gallery script to allow easy updating of the gallery. This idea got rather convoluted along the way, and somehow gave birth to the idea of making a whole CMS from scratch. I spent a bit of time studying a few of the packages out there - CodeIgniter being the most helpful resource.

Meanwhile, poor Tom is still awaiting a simple redesign - something I've had to stick on the back-burner. But when I finally get round to building the website, I'm intrigued to see how easy it will be to implement my new CMS into the website. I hope to get this up and running in the next few weeks, so stay posted if you're interested to see how it turns out.

If that particular project is a success, I may attempt to convert this blog to the new CMS. With a big back-end change like that, however, you can probably expect a fair few front-end refinements too. A whole re-design perhaps. Eventually, the plan is to create a dedicated portfolio, running on the CMS.

I'm excited about 2011, I think it's going to be a good year. And while I mention it, Happy New Year!