Site Design

crschmidt.net is run mostly out of PHP. It's a messy site, with lots of extra files all over the place, many of which are left over from, literally, years ago. I've recently started to make an attempt to clean it up, and one of the things that I would advise everyone to do is to create/use a simple templating system.

In PHP, I do this using output buffering, after which I use a regex to map content. I have several of these templates, although I don't think I use more than one at a time. Basically, all I do is create one template, and then my actual pages just include that template at the top of the file. Once I do that, I put in a <title> and <body> content, and everything else is taken care of for me. An example of it in use is available from lorebot's svn.

I've built 6 or 7 of these templates for clients, and they definitely help me to keep a site's navigation clean, while allowing me a full reign over flexibility if I want it. For example, a couple of the sites use a sidebar: but for things like that, I just add support for an additional <sidebar> tag. Or if I want page-specific <head> stuff, I just add support for <headdl>. It's really quite simple. The best part is that I don't have to do a thing in order to get it to work: if I write a full HTML page, it'll just pull out the relevant bits, and work as expected. It's really quite grand. So, I'm just putting out there that I think that using a simple templating system can be a really great thing for site design.

* Posted by crschmidt on #d8uv.com at 2005-01-31 03:02:17 UTC.
Christopher Schmidt, and other various and sundry characters.
All code which runs this thing was stolen from sbp. Based on the original nœts site, circa 2003. Design by d8uv, xover, with help from the works of Eric Meyer. Any other people who were involved are also credited and thanked here, in this very small space: . Thank you.