Loving me some PHP today
Posted on August 15th, 2008 in Geek Stuff, PHP, Programming, Web Development | No Comments »
Today I had the misfortune of having to migrate a website from one server to another for a sister company of ours. I say misfortune because this website is coded in the nastiest bit of Cold Fusion code I have ever seen. I mean it looked like a script kiddie that just learned how to regurgitate CFML from the back of a cereal box tutorial wrote it. And I had to make it work on a new server.
Did I mention that I haven’t been in Cold Fusion for over five years? And I hated it then.
Good thing that I am a fairly adept PHP developer. Instead of futzing with crappy CFML I decided to spend a few hours trying to port it to PHP in a sensible way with sensible coding and sensible architecture. The result was that I built a mini-MVC framework for it in about 4 hours. Aren’t I awesome? Well, isn’t PHP awesome?
I can do a lot of things in PHP typically in a short amount of time. I can write test snippets, mini-apps, middleware, all sorts of goodies fairly quickly when I need to with this language. And what I write generally is easily understood (comments anyone?) and easily maintained. I cannot say that about that pile of crap that was the Cold Fusion site. That stuff stunk like butts on a hog. But I shall try to not focus on that so much as tell you how much I love PHP today because it let me create a nifty little mock MVC style framework in about half a day.
Well, actually it is more of a VC framework with a small data handler object that talks to MySQL only. But it gets done what is necessary in an OOP style and is very easy to understand and maintain. Which is what I want.
Now all I have to do is port their templates and CSS over to something cleaner and I will be able to get their site off that vomitous mass of Cold Fusion Crap and on to something a lot prettier, easier to manage and, in my opinion, just plain better.
PS And if you are ever going to make a static HTML page for a single row of a database table, do not, anywhere in your code, set the row ID of the page information as it comes from the database as a hard coded numeric valued variable, then check if that variable is numeric, then pass that to the database as a query to get the page information of the page you are on. That is just stupid, plain and simple. Be smart, develop smart and use your brains. That is why we have them, to keep from making stupid mistakes that other, smarter, people might laugh at you for.