March 30th, 2008
Wordpress 2.5 has come out of Release Candidate testing and is now available for general consumption. The biggest feature of the release is a completely overhauled Administration interface.

I had a change to play around with the release candidate and the new interface is certainly a step in the right direction; I especially like the new colour scheme. Also, the media manager has been cleaned up quite a bit, and tinyMCE seems quite a bit faster.
January 23rd, 2008
Y’know why SQL is great? Because the easiest queries you can execute are ones like DELETE and DROP.
I’m having a bad database day.
August 3rd, 2007
The surprising success of Rails has given rise to a huge number of PHP Frameworks that have recently seen a surge in popularity.
One of the much-lauded features in Ruby, and it’s PHP clones, is the adoption of an MVC Architectural pattern, which, simply put, seeks to separate presentation from logic from data.
Sounds great doesn’t it? The only problem is, using a PHP framework incurs a huge overhead for your application. Of course, all the frameworks in question offer much more than an easy way so structure your application, but if this is all you want you could be left with a huge library of classes that you will never use; hardly an ideal situation.
This is a dilemma in which I found myself recently. I was developing an application for a group of musicians around my area. I needed it to be speedy and reliable, so I was reluctant to use third-party code; no matter how acclaimed. But I also wanted to use MVC patterns, along with clean urls. As I was adamant about knowing exactly what was going on in my app, and am familiar with how most frameworks implement MVC, i decided to code a simple MVC system that I could build upon later.
Here’s the basics of how it works:
- .htaccess file: A rewrite rule is created to route all request (bar resource requests like .css files, .js files, images) to index.php, which handles all requests for the application; this is known as the bootstrapper.
- Bootstapper: The bootstrapper (index.php), is where all requests from the client are routed. This script simply establishes environmental variables, and runs the FrontController.
- FrontController: The FrontController is responsible for parsing the URI and forwarding requests to controllers and actions. The first piece of the URI (http://example.com/first) is mapped to a controller, the second (http://example.com/first/second) to an action, and all other elements are passed as parameters (http://example.com/first/second/parameter1/parameter2/parameter3). Once the FrontController has figured out what the URI should be pointing to, it runs the required controller and action. Note: if an action is not called, an action called Default, which is in every controller, is called.
- Controllers and Actions: The controller, which is always in the format ‘Controllername’Controller.php, is a class that is instantiated by the FrontController when called by the browser. Actions are functions contained within this class. If a user visits the url http://example.com/news, the controller NewsController.php is called, and the Default action is run. If a user visits http://example.com/page/about, the controller PageController.php is called, and the function About is run. If the page http://example.com/user/view/conor is requested, the Controller UserController.php is instantiated, the function View is called, and ‘conor’ is passed as a variable.
- The Model: The model always refers to the data and the code that manipulates it. I implemented a simple wrapper class for mySQL and that was it.
- The View: The view is the presentation: the html, css, images, etc. Not wanting to completely reinvent the wheel, I just created another wrapper class that inherits Smarty. Although my aim with this application was efficiency, I didn’t mind using Smarty given its fantastic feature set like compiling and caching. I was already well-versed in its unusual syntax so there was no learning curve involved.
And thats it. This is a basic outline of how my system works; it is a near carbon-copy of similar systems like Ruby and the Zend Framework. I’m planning on writing up a simple tutorial for this; mainly so I have a reference to go back to in the likely event that I forget how I did it. In the meantime, you can see this in action here (Note: this site is nowhere near complete, so ignore everything except how the URLs work…).