Hi all,

I'm investigating different methods of templating at the moment, and specifically the viability - or not - of storing templates in a MySQL database. I've done a bit of Googling, and really can't find anything of worth on the topic; I'm not sure whether that's a good or a bad sign!

My specific situation at the moment is that I'm just starting work on a rebuild project. It's going to be on a dedicated box, and although undecided at present, MySQL may be running on its own dedicated box again (the site as a whole is projected to be very big once it's relaunched).

The part of the site I'm working on is a message board, and due to restrictions from how the rest of the site has been built, and the setup of the server itself, I cannot use any packages or addons or whatnot (PEAR, for example) - so I'm talking pure PHP and MySQL.


The currently live version of the site is running on a shared server, which has become increasingly slow and unreliable recently. Consequently, I took the chance to do a bit of testing with a couple of different template types, and whilst other pages (mostly mucky inline code, it's that old) have been taking up to about 30 seconds to load at the worst of times, the pages I've changed to load the layout from MySQL-based templates renders in a second or two at most! (I should add that when the server's running fine, all pages load instantaneously with no discernable time differences.)

Now, that speed issue could just be a huge coincidence, but it's consistent in being faster than other methods. I had been planning on rebuilding with a more traditional set of template flatfiles on the server, but speed is obviously quite important and so although the system setup will be slightly different (dedicated rather than shared, mainly), I'm now considering my options.


So does anyone have any thoughts on it? I'm really not sure what road to go down at the moment, and would greatly appreciate any thoughts or advice, particularly if from experience.


And just to be clear, I'm only interested in comments on the various templating methods and their inherent pros and cons; nothing too implementation-specific such as SQL injection, which I've seen mentioned on a couple of other sites where similar issues have been brought up.


Right. That's about it I think. Looking forward to hearing your thoughts. Hope it made sense!

Thanks in advance.