CMS? DoItYourself! (version 4.0)
Long, long ago, in a galaxy far far away, I began writing my own web-site. Since I'm a control freak, I decided to write it down from scratch directly in html. No bullshit.
Now, that's fine if the site is relatively small, but after a while is going to get tought, especially if you want to change something that is in every page like a logo, or the style of the title. Manual editing is slow, tedious and errors-prone.
Well, that's why mankind invented CMSes (Content Management Systems), so you can concentrate in writing the content and let the system take care of the rest.
But... I couldn't find a CMS that I really liked and could do what I wanted.
First of all, I want to be able to divide my site in "pages", each one is a document on his own, each one has common parts (title, navigation bar, wathever) but potentially each one could be totally different from the rest.
Second, I want to be able to divide the site in sections or directories to logically manage everything. For example, all the documents in a section could be showed as a list or a group. All the documents in a section could or should have common characteristics (style, templates...). But still, I want to be able to decide per-document if it is going to be in the list, with that style and so on.
All the CMSes I saw had some kind of integrated editor, that was kind of shit. I'm used to write off-line, maybe I write the same stuff ten times and sometimes after that I simply throuw it away. An off-line editor is the best for me. It also allow me to use wathever editor I want to prepare the document and then upload it when I'm satisfied.
Well, it doesn't sound like a too complicated list of whishes, does it? Only, I couldn't find any CMS that did what I wanted. Not without rewriting huge portions of them or paying a lot of money. So, in the end, I decided that if you want something done, you'll have to do it yourself. So I sat down and began writing my own CMS. The FdT (Fai Da Te = Do It Yourself).
The first draft of the CMS toke about 2 days. It didn't used a database, just plain text files. The 'CMS' did nothing but "merge" the files together and send the mashed stuff to the browser. But functionalities were really limited and required direct access to the server to add or change things. Some things were also basically impossible (comments).
Version 2.0 began right away with a database backend and a minimal backoffice interface to allow changes and updates without direct access to the server. A huge improvement, but still wasn't satisfying.
During Christmas' break I wrote version 3.0 with lots of changes. Better documents management, multiusers and a skeletal multihosting functionality. But the backoffice was still somehow lacking and the design of the database was crude and unrefined (it didn't have any foreign key).
After some time spent using the thing, I decided to do a major rehauling of the project and here cames version 4.0. The database is changed a lot, it has referential integrity, it is multi-host and multi-user and the documents are really hierarchical.
Version 4 is the actual "production" version. Is also the one that is currently under maintenance. Basic characteristics:
There are a lot of things that I want to improve, in specific, I'd like to add some interactivity in the system, for example in the document management: I'd like to do drag & drop of a document from a directory in my pc to the system and get the "upload" window. Or move a document from one group to another in the same way.
As said, the whole CMS is written in Perl. I wrote it using 5.8.8, but I've also tested it on OpenBSD with 5.10 and had no trouble. Why did I picked perl? Because 90% of CMSes out there are written in PHP. And that means that 90% of jackasses that could think to came here and annoy me knows PHP. So picking a different language is a fast and easy way to get rid of 90% of the problem already.
I decided to split the system in 2: the cms properly named is the part that grab wathever the user type in the address bar, recover the document, apply a template put everything together and send it back to the user, and then there is the backoffice, that is the part used by me to add and manage the content of the site. This allow me to reduce the risk of having an 'active' site: in the 'cms' there are no "update" to use to add stuff to the system.
There are some common parts, some functions that are used by both parts. All in all, is just an half a dozen perl scripts.
To do antispam and check of the comments I used SpamAssassin with a couple of custom-made rules. So far, just 3 or 4 comments managed to get through. And since I always do the final check by hand, no spam-comment reached the web yet.
In my conception, the document is the King. The document contain the main text and content of the page, what al the users wants to see. The rest is just around the document to let it display.
This approach shows in the fact that 90% of the system is devoted to manage documents and the rest is for support functions. However, you need to have the support bits in place before you can start adding documents.
Let's see a practical example. Let's supposed you did installed the system and want to test it. You begin by adding an host, that is, a site. Once done that, you need to create a template, that is nothing more than an HTML page where you specify where the various bits are going to be, using <div> or <table> or wathever.
Once you have these, you can add a document and 'attach' the template. Only at this point you can see the resulting document. Change the template and the document changes.
The same document can be in more languages. The cms look up the document in one of the language that the user's browser accept. If no document matches, the default one is returned.
A template can be applied to the generation of lists and directories too. This way is possible to personalize how the various lists are displayed on the page.
Some portion of a page are common to other pages (title, navigation bar, disclaimers...) these 'fragments' are managed separtely from the document and the template, this way you can have multiple version in different languages. To manage even smaller elements (single words) the default texts are used.
To piece together all the bits, the cms understand metatags, that looks like html comment but are processed by the CMS and replaced with documents and other informations coming from the database.
In the CMS documentation (distributed as a site and available on line) there is a list with all the metatags and their meaning.
Warning: the CMS is still in beta, so don't be surprised if something doesn't work.
Before beginning, I suggest you RTFM, especially the part about required perl modules. During the debugging I've installed it on many virtual servers, installed from scratch and I had no trouble installing the required modules. If you run into troubles first of all check your modules. If you're package-manager-freak and can't find the modules in a packaged version for your distribution, you have to build it yourself or complaint with your distribution.
For some strange reason I'm thinking about java now... Maybe I'm getting old...
Anyhow, I'll move all the discussions to the CMS web site, this article remains as a connection between the two.
Comments are added when and more important if I have the time to review them and after removing Spam, Crap, Phishing and the like. So don't hold your breath. And if your comment doesn't appear, is probably becuase it wasn't worth it.
By Davide Bianchi - posted 14/10/2009 10:08
CMS FdT 4.0
By Marco - posted 10/03/2010 17:30
By Davide Bianchi - posted 10/03/2010 19:59
By Alessandro Porcu - posted 12/04/2012 15:33
Installato su Gentoo va che e' una favola. Ho solo il problema di ripristinare i commenti che c'erano sul vecchio wordpress, al limite me li riscrivo a manella.
Grande BigD !!
By Gandolfo Ivo - posted 17/11/2012 23:50
Ciao BigD, mi appello alla tua Grande Saggezza per un quesito che mi attanaglia.
Ho provato a usare il tuo cms, con un discreto risultato, solo un piccolo appunto: farebbe molto comodo avere un editor online per i doc oltre che per i template, ho visto che tempo fa avevi messo FCKeditor (dalle note del SVN) ma poi lo hai tolto. Un'altra soluzione per integrare un editor c'è, oppure devo copia-incollare la funzione di edit dei template e usarla anche per i doc?
a little sysadmin from h3ll
@ Gandolfo Ivo
By Davide Bianchi - posted 20/11/2012 15:06
farebbe molto comodo avere un editor online per i doc
Ho abbandonato l'editor on-line per molte cose, avevo provato con fckeditor (ora ckeditor e basta) perche' non mi soddisfava molto, potresti riaggiungerlo se vuoi madonnare.
Davide Bianchi, works as Unix/Linux administrator for a "network security" company of Haarlem. Contacts: mail: davide AT onlyforfun.net , Jabber: davideyeahsure AT gmail.com, Follow @TheRealAndOnlyD
Do you want to contribute?
This site is made by me with blood, sweat and gunpowder, if you want to republish or redistribute any part of it, please drop me (or the author of the article if is not me) a mail.
This site was composed with VIM, now is composed with VIM and the (in)famous CMS FdT.
This site isn't optimized for vision with any specific browser, nor
it requires special fonts or resolution.
You're free to see it as you wish.