Hey everybody
Tomorrow school starts again, which is ok, because I'm ready to go back to having stuff to do, although i've just starting making Towel, my new CMS idea. Now, what is different about Towel, you might ask. Well, it's different because it's object orientated and all, but it's actually started to be implemented.
You can see it kind of in action at http://thenew.pftqg.com/. It's implemented using Apache's mod_rewrite, so should theoretically survive the move to Apache2, if I ever make it.
Basically it works thus:
You enter a url, click a link, whatever. If the URI you enter gives you a real file (one that is actually there in the file system), it just gives you the file (as long as you satisfy any other restrictions, such as those that might be found in a .htaccess file). If however, it's not a non zero-length file, it gets passed to towel's boot.php. This kicks in a config file and the main towel class.
It then checks to see if what you tried to access was a directory. If it is, it kicks back giving you an error (basically saying it won't list the contents of that object). Later on, I will probably add some mod_rewrite rules so that you'll actually get a document (if one exists) that satisfies the DirectoryIndex. For now, it's not a worry.
If you're still with the script at this point it looks up the request in the virtual-to-id map table. Of course any one ID could have many virtual url's, and in fact needn't have one at all, if it's not accessed in that way. An URL may only point to one ID, presently. In the future I might add addt'l ID's as a way of doing failover, time based mappings, etc. For now, if you had the code, and desperately needed it, you could just hook it in.
Now we have an ID, we go and look it up in the idtable.
This gives us two important pieces of information. 1. The handler (called a 'towelrail') 2. Context information. A simple object could live entirely in the context area - such as a simple html file or a simple text file. Using the handler (which gets converted into a class name) and the context details, a towelrail object is made, content type retrieved, check to see if we are going to redirect, and then finally the output is written.
(As it happens, 404 & 403 errors are done through the same displayPageWithVirtualPath() function as every other page is.)
Right now there is no admin interface. The handlers are simple and really just directly replace the filesystem (there are three towelrails at present: simple:text, simple:html and simple:redirect, which redirects to the URL held in the context field). I of course currently plan for this to take over my site. If I work it right there is no reason for it not to take over my blog as well.
(I would have to do the blog->LJ thing though, definately.)
And the nice thing is: the URL beast finally is truly easy to tame... If I want to move something I just change add a mapping. Or perhaps add a mapping and modify the old one to map to a redirect. Ah the joy of making your own CMS!
Wow, this entry kind of turned into 'how towel works'. BTW: If you know there is another CMS named towel, you could tell me, or not. If you wrote that CMS: go away.
damok guessed pretty quickly (as he should've) the reference in the towel's name. Can you?
