WordPress and Smarty

I was drafted in to help on WordPress a long time ago. Unfortunately I haven’t done much work on any OSS projects in a while and it was bothering me.
I did do some useful work though – I found out that the Smarty register_resource construct was buggy when using caching. That rules out using MySQL as a backend to hold templates. (I posted a mail to the Smarty list but nothing came of it. *shrug*)
Finally, after re-installing Linux on my new hard drive last weekend I Smartyised WP! Here’s a WIP snapshot.
What does it do? Well, I wrapped some of the Smarty template API (ie. bloginfo(), etc) in Smarty functions of the same names. I’ve only done enough to get the default template working, as it’s laborious work and I wanted to get something out quickly!
The template is split up into 3 parts: top.tpl, post.tpl and end.tpl. They live in users/main/templates/ and can be edited there with a text editor. The online editor from b2++ will make it’s way there eventually probably.

Before trying this, please be sure to backup your WP installation. The files in the tarball don’t conflict with the files in CVS but I can’t guarantee that this won’t delete all your WP install files if you’re not careful!

Download the WP – Smarty mod. (40Kb)


You might also like

If you like this post then please subscribe to my full RSS feed. You can also click here to subscribe by email. There are also my fabulous photos to explore too!

4 thoughts on “WordPress and Smarty


  1. Is there is a speed difference as it is? No I don’t think so. Quick tests done by hitting refresh a lot showed me that traditional html+php WP was about as fast as Smarty WP.
    When we start caching comments, posts, trackbacks and other data then you should see a huge difference as database requests are eliminated.
    Even now however you have the abstraction of code from presentation using this mod. That’s a win and worth implementing even if no speed-up is observed IMO.

Leave a Reply

Loading Facebook Comments ...