Wordpress templates

by Naneau

I am a design nut, though I am not a skilled designer. I do want to have great control over how everything I produce looks. Or I want to be able to tell another person exactly what I want it to look like, and how to make it look like it. That means that I need to have control over how certain bits of data get translated into certain bits of (x)html.

In everything I create there is some kind of templating-system involved. My personal preference is still Smarty, but there are many valid reasons to prefer others. I will not go into the reasons behind separating logic from design here, but it’s something you just have to do.

The thing with this separation is that it is an idealistic approach. You would want to tell some poor designer, who you don’t expect to be very good at coding, to do something with ‘data’ your program delivers. You still can’t do that, unless you’re just really mean and hate the coding-impaired. I often find myself designing the ‘base’ templates myself, getting the hard stuff out of the way, leaving just fine-tuning and CSS magic to a decent designer.

When I created the templates for this site I had never worked with wordpress templates before. I have had wordpress installs, but I’ve always used pre-made templates. Because I lacked experience I started looking at some templates I liked and played around with them a little. Wordpress uses no separate templating engine, but allows you to write mixed php/html code around what they call ‘the loop’.

This is fine, it’s also the approach you’d find in many applications built with the new Zend Framework for example. But looking at what other people create gets difficult when it’s a mix of hacks, poorly formatted coding and inconsistent approaches. The lack of a real templating engine gives people the freedom to do with their weblog output whatever they want.

I just think it gets, well, messy. Why do people use inconsistent indentation everywhere? When designing templates I just let my html itself indent, not the control structures around it. This may seem weird at first, but it makes the code a lot easier to read. It also makes you think twice about writing too much ‘logic’ in a template, which I feel should be avoided.

While I can see many valid reasons behind not using a separate engine for templating, it puts users in charge and most of them aren’t really programmers. It’s always the most beautiful templates that are a mess under the hood :(