How to Build a Content Management System

October 5, 2008

OK, I just tricked you! This article is not going to teach you how to build a content management system with PHP from scratch.

Why not?

… Because building a content management system from scratch is (probably) a really dumb idea!! Now that I come to think about it, building any of the most commonly used software from scratch, is kinda stupid.

Things you should not build from scratch:

  • Content Management Systems
  • Blog Software
  • Forums
  • Directory scripts

The Top 3 Rules in Programming

The real estate business has a famous set of rules – the top three rules in fact:

  1. Location
  2. Location
  3. Location

The idea behind this rule, is to stress how important location is to a piece of property. In software development (programming), we have a similar set of key rules:

  1. Reuse
  2. Reuse
  3. Reuse

Yes, if you are a smart and experienced programmer, you know that the first thing you do when someone approaches you with a project, is to fire up Google to check if someone else has already built something that is at least similar to what you want to create.

… Simply stated, it is crazy to reinvent the wheel and build something that has already been created. Especially within the context of building a program to help support some business. What I mean by that is, that unless you are building a piece of software as the core of a business, where the software itself is the business, then you should not be starting from scratch. It’s just too expensive.

Lucky for us PHP nerds, there is a huge collection of open source, free and nearly free software out there created in PHP. Things like the above mentioned blogs, cms’, forums etc … have been created many times over by teams of adventurous nerds. Given that fact, it makes even less sense to build these things yourself, just because you need one for your website.

Don’t ask me how to build a CMS!
No, instead of trying to build these (typically) big and complicated programs from scratch, you should download a proven mature product where they have already worked out many of the bugs and spent the hundreds of hours refining them.

Suggestions:

A good blog software: http://wordpress.org/

Forums:

http://www.phpbb.com/
http://fluxbb.org/
http://punbb.informer.com/
http://www.vbulletin.com/
http://www.invisionpower.com/community/board/features.html

CMS

http://drupal.org/
http://expressionengine.com/
http://www.cmsmadesimple.org/

Believe me, there are many more out there.

Thanks for reading,

Stefan Mischook

www.killerphp.com
www.killersites.com

23 Responses

  1. RST Author October 6, 2008 at 3:36 am

    There are at least two reasons why building a CMS from scratch is the opposite of dumb. 😉

    1. A client really needs a tailored CMS and existing scripts won’t do.

    2. If I have a software company with skilled programmers, why would I use an existing CMS when I can create a good one myself and sell it to other people.

  2. lacisoft Author October 6, 2008 at 4:42 am

    I do not agree with you. People should try to build something. Because that is how many CMSes (Drupal, Joomla, Typo3 and so on) have been made. Someone had a vision and wanted something. He put energy into it and built something. Sure there are cases where building a CMS is just pointless for the task in hand. But i saw many projects where existing solutions proved to be very inflexible and caused much more trouble then it was the case.

  3. Stefan Mischook Author October 6, 2008 at 9:54 am

    RST,

    To answer your questions:

    “A client really needs a tailored CMS and existing scripts won’t do.”

    Well, all you need to do is modify and existing CMS. If the CMS is reasonably well designed, you should be able to modify it to suit your needs in most cases.

    If on the other hand, you want to get into the business of selling a CMS, then building from scratch can make sense.

    Stefan

  4. David Dashifen Kees Author October 6, 2008 at 9:59 am

    I’m torn on this one. I think it’s important for people to try their hand at forums, blogs, etc. because they’re somewhat foundational to the modern web and, by trying to build them yourself, you’ll better understand the methodologies of that web. Further, since the functionality of such tools is often well-defined, they make wonderful educational tools for someone to use to enhance their programming skills.

    Secondly, I usually find that my customers specifically tell me that they don’t want to use commercial or free third-party tools because they don’t want people to be able to recognize that they’re using other people’s work. They want their own site, with their own look/feel, made from their own code, that works just for them. That sort of specificity cannot often be found simply by modifying an existing site.

    On the other hand, if you’re client or boss is open to third-party tools then I’m a strong advocate of using them if only to save time for those projects and programs that must be performed in-house.

  5. Stefan Mischook Author October 6, 2008 at 10:01 am

    lacisoft,

    Projects like Drupal, Typo3 etc … have had hundreds (if not thousands) of hours invested in them. It is not likely you will be able to create a CMS that is nearly as functional or robust. It makes more sense to find a well designed (object oriented) CMS (Expression Engine perhaps?) and modify that.

    As with all my opinions, this one is based on real-life experience, not some theoretical thinking.

    Stefan

  6. Stefan Mischook Author October 6, 2008 at 10:04 am

    David,

    I would argue you would learn a lot more quickly by weaving into an existing project adding new functionality/modules. It is in fact extremely educational to dig into other peoples work to see how they did things.

    For instance, WordPress has a good plug-in architecture making it easy to alter the way WordPress works.

  7. freddy Author October 7, 2008 at 11:57 am

    nah dude, if you’re a beginner, building a CMS, Blogs and Forums are the way to go so you can learn your shizznit! Then, after you know how to code, using an existent script is way faster then re-inventing the wheel every time. Good stuff. – freddy

  8. Maria Irrera Author October 8, 2008 at 2:15 pm

    Stefan,
    You are saving my sanity with your wonderful tutorials. I can not tell you the money I have spent on “beginner” books that assume I know programming when what i know is clever cut and paste.

    I have worked my way down to your PHP forms tutorial and I am embarrassed to say I have never had to build an HTML form from scratch. You mentioned that you had a refresher tutorial on HTML forms on this site and I have searched fruitlessly. I know I would eventually find it because I am addicted to procrastination and the hunt, but I see that you post regularly, so I thought maybe some other newbie might want the same info.

    Again, your videos are superb! I can’t believe you even pointed the way to me actually running the server on my computer. Many failed attempts to do this the hard way, all the time going “Why do i need to do this when I have a hosting provider?”. You addressed it beautifully, and I have installed Xampp.

  9. Stefan Mischook Author October 8, 2008 at 10:01 pm

    Hi,

    My forms video is contained in my basic web design package. You can find it here but it has a small cost: $19.99.

    http://www.killersites.com/web-design

    Hope that helps.

    Stefan

  10. Maria Irrera Author October 9, 2008 at 10:07 pm

    Thanks Stefan,
    I figured it out using Google, but I am going to purchase your beginner videos anyway. I realize starting out as a graphic designer myself, with no tech experience, I have advanced through cleverness, but no real foundation. I think going through your videos will fill in some gaps, even in HTML. I hope you keep posting tutorials!

  11. Stefan Mischook Author October 10, 2008 at 12:19 am

    Hi Maria,

    I will continue for sure. You can actually expect a few new ones soon.

    Stefan

  12. Christain South Author October 12, 2008 at 2:27 pm

    Stefan,
    I guess I can see this one from both sides of the argument. The time you spend “reinventing the wheel” could almost certainly be put toward more productive learning experiences else where. With that said… I probably don’t have anywhere near the knowledge that most other people in the above comments have. As such I have a fairly different prospective then the above people (the newbie). I find that I learn a tab bit more not by just using the application that I can get “off the shelf” from a download, but by started to build my own and researching how the others go about doing x when I get stuck. No doubt when I have the years in that you and the above have I may change the way I look at it, but currently this is the way I look at it. I think you could actually learn more from the building experience then just reading through someone else’s code that is almost always poorly documented, broken up, and just plain ugly.

    I sit back and await my flame 🙂

    Christian

  13. WebGyver Author October 15, 2008 at 10:20 am

    Good article, Stefan! Thank you.

    You can always tell you’re on to something when you hit a nerve and people start participating in the discussions.

    Personally, I couldn’t agree with you more: Why reinvent the wheel (unless you need one that’s not round and doesn’t roll very well)? Then again, I have a boss who couldn’t be convinced that outsourcing $50K for another MySpace clone was a terrible idea.

    QUICK QUESTION: What do you mean by “Directory Scripts” and what is out there that can be re-used?

  14. Stefan Mischook Author October 15, 2008 at 11:38 am

    WebGyver,

    When I mentioned directory scripts, I am talking about directories like our web designers directory:

    http://www.killersites.com/directory/

    You said:

    “I have a boss who couldn’t be convinced that outsourcing $50K for another MySpace clone was a terrible idea.”

    Yea. Been there, done that!

    I would venture a guess, that the people who think building a CMS from scratch is a good idea, are probably those who haven’t much experience in the real world.

    Like my old boxing coach used to say: “You don’t really understand why you should put your hands up … until you get your nose broken a couple of times.”

    … Fortunately for me, rhinoplasty is reasonably cheap these days!

    Stefan

  15. Willem Author October 16, 2008 at 12:04 pm

    I agree on using a open-source CMS, but i also have the impression going through the documentation of these CMS’s that there are certain limitations imposed by them. Now, I don’t have much experience using Drupal or Joomla or CMSMS, so I hope someone proves me wrong.
    But can you build a website for a client with their own admin system (next to your bigger admin system which includes the Drupal setup) and then setup the views just like you want (multi-image gallery) with a Javascript framework, built into the views and the client’s admin system.

    Then to me it seems easier to do it the ‘old’ way. Although i’d love to be proven wrong.

  16. Stefan Mischook Author October 16, 2008 at 1:24 pm

    “But can you build a website for a client with their own admin system (next to your bigger admin system which includes the Drupal setup) and then setup the views just like you want (multi-image gallery) with a Javascript framework, built into the views and the client’s admin system.”

    Depends on the CMS and how well (modular) it is built. A good OOP based CMS should allow you to hook into it and add new functionality.

    That said, I would still hold that in most circumstances, it would be better to base your work on a mature open source CMS than to start from scratch.

    … Just think about all the things they’ve already have in place!

    Stefan

  17. Ashley Author November 26, 2008 at 1:15 am

    On a professional level, you should be selling your own code. Taking an existing CMS and tweaking it to meet a clients needs may be quicker and cheaper, but cutting corners is not the key to successful business. Sure you’ll be making something that has been done similarly somewhere else before, but think about it, doing bespoke jobs with tweaked, existing applications does not make sense!

    Most clients are paying to get their own things made, not for developers to take free/open-source applications, change them (which, let’s face it, you don’t need to know much to do), and sell them for high prices. To anyone who does this practise at work, I bet most of the time you will not make it clear to your clients that you’re even doing this. I totally understand re-using code, it is a necessity, but that is more about re-using your own code, not someone else’s.

    It’s worth creating a CMS structure yourself, and working with that code on each client project. Yes it may take a while if it’s going to be a particularly big system, but suck it up, that’s the work life for you. You should know your own code. You’ll have integrity, you’ll be selling YOUR work and not ripping off clients. This is something you can take pride in, and the fact it’ll all be your own work is a great way to sell yourself.

    To those that are going to go down the road that this article is supporting, be very careful around the laws of selling free and open-source applications (even if very heavily modified, usually the least you need is some kind of license/agreement where you will need to pay the original creator(s). And make sure your services are advertised with the upmost honesty. “It’s only illegal if you’re caught” is so not true. I wish all the best to you aspiring web designers/developers out there!

  18. sideright Author December 8, 2008 at 6:23 pm

    Building you own CMS can be very beneficial to the team because of customization. Anyone looking to build their own CMS should just google CMS tutorial there are plenty of good ones out there. I suppose you’ve never built your own CMS?

  19. Stefan Mischook Author December 9, 2008 at 12:08 am

    I’ve built them 7+ years ago because at the time, I had to.

  20. Gary Author December 11, 2008 at 11:07 am

    Stefan
    If I simply want to build a ‘simple’ web site — where my friends can review / share their ideas about the restaurants in the city I live in… and then have a message board like what you have here….
    Am I better off using an existing cms… and modify it
    Or is it easier that I write my own?
    I am not in to the “fancy” feel and looks… just want something robust.

  21. Stefan Mischook Author December 11, 2008 at 11:25 am

    “Am I better off using an existing cms… and modify it”

    It is by far the better choice to use an existing CMS and modify. By far!

    Stefan

  22. Chuck Middaugh Author October 26, 2009 at 1:29 pm

    Reading through these replies, I get the feeling that a few people have never read the GNU/GPL agreement. GNU/GPL software has one primary intention and that is to progress human knowledge to the ever changing next level. If you spend your time “reinventing the wheel” what have you gained? So, now you have yet another wheel, good for you. There is no reason that you cannot develop new extensions, modules ans plugins to your favorite GNU/GPL CMS and sell that packaged with the custom template. It is your legal right and it is in the spirit of GNU/GPL to do so. If you improve on existing portions of the GNU/GPL code, then share it that is all that is expected of you.

    I have been developing websites for many years oblivious to my need to learn anything new. I wrote clean XHTML 1.0, CSS 2, and Javascript code. My websites were beautiful and highly functional. I thought to myself that I was doing well enough, until I was asked to build a forum with calanders and various other accoutrements, and they wanted it in one day.

    “What”, I thought. I cannot do that. I understand what that would take and even how to go about it, but the deadline was not possible for just me to accomplish. It was just physically impossible. I should mention here that at the time I had never even heard of CMS. Needless to say I was “let go”. As I continued working on building said website to satisfy myself that if I was ever faced with the same situation I would already have all of the elements within my possession, I began learning PHP (from this website) and googled every known term I could think of to search for and learn.

    Fortunately, an old friend wrote to me and happened to mention Joomla, so I looked it up and not really understanding what CMS was all about I installed it on my localhost. Sceptically I began combing through it and found, to my amazement that it was what I was trying to do. I have learned to do so much by seeing how it has been done.

    Stefan, I must agree with you. I got my nose broken and now my hands are up. Learning from experience is painful, and learning to listen to good advice is the path of wisdom. Stefan, Thank you.

  23. Stefan Mischook Author October 26, 2009 at 1:45 pm

    Hi Chuck,

    I’m happy to hear I was able to help.

    I too have been in your situation and unfortunately, for many of us, it takes a broken nose (or two) before you learn!!

    … I got the crooked nose to show for it too!

    Stefan

To Top