Recreating a CMS

by Benjamin Williams

Posted on 9th June 2014

Recreating a Content Management System has been the most stressful part of my life in recent weeks. I had a CMS that I created myself two years ago, and it's worked brilliantly for me since. I've decided though that it's time I moved on from MySQL though and go for MySQLi.

Now, I could have gone for the easy route, and replaced certain instances of MySQL functions with the MySQLi equivalent - basically just adding in the i. I didn't like that though, was just something about it that seemed too simple. So instead I took up the task of rebuilding from top to bottom. Brand new code from scratch.

This has allowed me some great advantages. I knew that some parts would have been difficult to update properly, and that I could potentially end up with more code than necessary to do new functions within the CMS. So I set about redesigning the databases I use, and started building the CMS with expansion in mind. No idea yet how I'd expand it beyond what I ended up building, but the point was that at some point I might need to, and now I have the areas to update easily.

I also have much less files. Instead of having 3 files to work on one section - like list all, add new and edit - I now have one file that can do all of this. There's also much better structure for files.

There's still one thing that I need to work on though, which I haven't done for this site. Why haven't I done it for this site? Well, quite simply, because no one by myself will be logging into my administration section. I do have Comic Book News to update though, as that still uses MySQL instead of MySQLi, and this is being worked on now. Again, I've having to build the CMS from top to bottom again, but this time I'm building in user functions as there's a few accounts for that site. So work is commencing on creating a CMS with user rights and a lot of functionality.

One of my main problems is picking a WYSIWYG editor for the article writing. I need something that can produce valid markup and works inline with what the sites look like. A lot of the editors out there don't seem to produce the <p> tags for paragraphs. They instead break paragraphs with DIV's or line breaks. Not interested in that at all. I might revisit some of them and edit myself so that they produce valid markup that works for me, as the paragraphs shouldn't be difficult to sort out. It's the adding of images that get's me most of the time though, as a lot seem to ignore the alt text. It's such a vital part of adding an image, I just can't understand why some people still miss this out when created a WYSIWYG editor. In the end, I've plumped for TinyMCE and edited that to suite my needs.

TinyMCE has a few faults, like it automatically adds image dimensions instead of leaving that to the sites CSS files, but these can be worked around and I removed the code that calls in this information. The look of it though is brilliant and that's part of the appeal. Quite a lot still look like Microsoft Office back when we were using Windows 98. It's 2014, we need something that doesn't look like a step back in time.

Overall, it's a challenge, but one I'm loving. And soon I'll have a lovely CMS that I've built myself from scratch that's so much better than my previous one.