logo

Practical Computing Advice and Tutorials

Tue: 23 Jul 2019


Site Content

Programming
&
Development


Technical Knowhow


Command Line Interface


Security

Defuse.ca's HelloWorld! CMS Review

In my Website Development page I introduced some of the tools I used to put together this site and covered an overview of Content Management Systems (CMSs). At the time of writing that page I was still looking for a CMS solution, which I'm pleased to say that I've now found and noted at the bottom of that page: This is a review of said CMS. To fully appreciate what I'm saying here, it would be best if you had some experience of how a website is built.

The basics are that you code each page using html, which needs a set layout, or structure. This provides the framework on which a site is built. The styling, or the look of a site, that is the colours, the text size and the like, can be coded into each page, but the problem with doing that is if you want to make a change, each page would need to be changed. This can be a huge task even if you only have a few pages. So, one of the ways around that issue is to use a CSS file in which all of styling information is coded. That CSS file (of which you can have more than one) is then linked to each page, the idea being that one change to the CSS file will change all the pages to which the CSS is linked.

Another issue that you soon fall over when putting a site together is Navigation. You'll see that at the top of each of my pages is the same Menu Bar. Again, if one had to change that on each page as and when new content is added, that could be a huge task. You would also have a lot of html code repeated on each page, as you do with the framework of each page; the sections needed by browsers in order to render pages correctly.

To save on code having to be repeated for each page, what about having the static code all in one file or files, which can then be included with the unique code that forms the content for individual pages. This is where a CMS comes in. The basic job of a CMS is to produce all of the framework needed to render a html page, while at the same time, include the unique content that each page requires.

As with any good idea, many people have produced systems which do exactly that. Some of them have grown into complex systems and business models and have 3rd party developers and advertisers producing an huge array of add-ons and plug-ins. The issue with that is that complexity is the enemy of security and it all very soon gets bloated and out of control.

This is where Taylor Hornby's CMS differs. It's a very simple and very clever system. He's developed a CMS that is fairly easy to understand, needing really only basic knowledge of html. If you know a little about php, that's even better. If you know a lot about php, you can vet the code for yourself, as it's all open source and there's not that much of it. The good thing about that is that you don't need to trust Taylor; you can vet the code for yourself. Try that with the WordPress php code!

As with any CMS, all the background stuff is done for you. Unlike some, there are no design templates or themes; you'll have to do that yourself. This is really a blessing as you don't have to trust any 3rd party developers and it's not that hard to produce a design of your own, even if you base that design on something you've seen elsewhere.

The good news is that there's a lot of help out there, so all you have to do is look for it and apply what you learn. For the layout design on this site, I've made extensive use of w3schools.com where I learned about HTML, CSS and PHP. I'm still learning and changing things as I go, but one of the biggest issues with developing an independent site is the content management. With this system, I believe I've now found THE solution to that issue, so thank you very much, Taylor Hornby.

I've created a bare bones site here so that you can see what to expect after you get the CMS up and running for the first time.

So, how does it work?

To fully understand what's going on under the hood, so to speak, requires a little knowledge about what php is and what php does, but you don't need a degree in Computer Science. php is code that is run by the web server. One of the things that php can do is to generate html code that can then be sent to your browser for rendering in just the same way as if the page rendered, was written in html. The practical upshot of that is that one php file can be used to generate all the stuff that every html page needs; any number of pages, no limit, the same php code being used again and again. It's also very easy to have this.php page call that.php page and have that.php page go get some.html file. Any resulting html code is combined into a single stream of data and sent to a browser. The engine of this CMS is called URLParse.php which is less than 450 lines of code, about 100 of which are comments and allow even a novice to follow along: I know this, because I am a novice.

The entire system is only about 20KB in size and amounts to less than a dozen files; you could assess the code during a lunch break! But don't let that fact put you off; it works in it's favour. Have a full read of what Taylor has written on his site, then I'd encourage anyone interested to get the code and give it a try.

I plan on putting together some hints and tips just as soon as I can and your feedback would keep me motivated, so if you're interested let me know via my feedback page.