When I started using b2 2 years ago, I wished it had a better template engine than it did. Using PHP functions, like it’s still done today in WP, leads to more cluttered templates. For me, that’s not an issue; I eat, sleep and breathe PHP. For someone like my girlfriend, or my dad, PHP is complex, confusing, and something they generally don’t understand, something they want to stay away from.
What irks me more about using straight PHP functions is the fact that functions tend to change as the application grows. WP is no exception to that. That means that with every upgrade, I have to cross my fingers and hope that everything still works like it used to. Also, I have to make sure that nothing I changed is overwritten by the upgrade. It shouldn’t be like that, and it doesn’t have to be.
Those that say that a template engine is “just replacing < ?php the_thingy ?> with {$thingy}” don’t understand the long-term benefits of a template engine. If you use {$post.title} instead of < ?php the_title(); ?>, it’s not about saving those few keystrokes. Who cares about a few keystrokes? You’ll only have to do that 1 or 2 times anyway.
It’s about making sure that your template doesn’t have to change when the_title() does. For my girlfriend and my dad, that’s great news. For me, it means that I can upgrade all I want, and unless {$the_title} is somehow no longer assigned, I can leave my templates alone.
Even better, since I use Smarty for other pages and things, I can really integrate WP with the rest of the site; I can use one, and just one, header file and just include that everywhere. Need to change something? Changing it in one file changes it everywhere.
I’ve seen people say “You can use the shorthand < ?= ?> construction”. Well, yes, you can, if your server is configured to allow that; it doesn’t play nice with other XML < ? ?> constructs, which (for me, being my own web hoster) is a reason to disable it. Besides, it’s not about saving those few keystrokes. Another favorite seems to be “Smarty is difficult, evil, and it eats your children”. I’ve used Smarty for several years, and although it needed some “getting used to” (coming from another template engine which did things differently), I’ve never found it very hard to use. I like the fact that I can place “modifiers” on vars ({$var|uppercase}, for example), and that it caches the templates to PHP files. I also hear these “Smarty is slow” remarks, but not from people who’ve actually used it (not just “looked at it”, but really “used it”).
However, nobody should be *forced* to use Smarty, or any other template engine, if they don’t want to. The best of both worlds for me would be having every function *return* it’s thing instead of just echoing it, of at least have a get_… version of each function. That way, I will be able to use template engine I see fit, and the “I want plain PHP”-types can use plain PHP. Everybody wins.
Of course, I could write a getter function that just opens an output buffer, runs the specified function with parameters, and tosses back the contents of the output buffer. Don’t know what it would do to performance, though.
Well, those were my lengthy 2 cents… =]