One of my major reasons for taking the MT 3.11 plunge is the prospect of dynamic publishing — that a blog page gets rendered on the fly when you go to it, rather than being stored as a static file. Not only is this keen aesthetically, but it has the potential of resolving some rebuild time issues (not to mention space issues). If I set up my blog pages as dynamic, except for the main indices (like the front page), comments and pings and posts should be lickety-split fast.
In theory.
Of course, I’m not going to screw around with my main blog for this. Instead, I’m going to try it out on one of my smaller blogs, and with the category archives as well. This is my progress.
- Download the official MT docs on the subject. Read them.
- Decide on a blog. I’ll use IDC, as it’s a relatively recent creation.
- Rebuild it under 3.11. All looks well.
- Set up the temporary cache folder as the /blog/idc/templates_c directory, chmodded as 777.
- Open up the very spiffy 3.11 xface, go to IDC, go to templates, open up the categories archive, and check the box that says “Enable dynamic building for this template.” Note that this text is not the same as what’s in the MT document (“Build this template each time it is visited”).
- Set up the .htaccess file per the instructions. Modify the reference to mtview.php to be /blog/idc/mtview.php.
- Rebuild the blog.
- Try to go to one of the category pages.
- Error! The error log file reads:
[29-Sep-2004 10:03:31] PHP Warning: context(MTViewer.php): failed to open stream: No such file or directory in /home/dave/public_html/blog/mt/php/mt.php on line 468
[29-Sep-2004 10:03:31] PHP Fatal error: context(): Failed opening required ‘MTViewer.php’ (include_path=’/home/dave/public_html/blog/mt/php/plugins: /home/dave/public_html/blog/mt/php/lib: /home/dave/public_html/blog/mt/php/extlib: /home/dave/public_html/blog/mt/php/extlib/smarty: .:/usr/lib/php:/usr/local/lib/php’) in /home/dave/public_html/blog/mt/php/mt.php on line 468Hmmm.
- Look at the actual blog directory. Note that, just as Phil Ringnalda explains, all the .html category files have been changed to .html.static (and can be deleted at my leisure).
Note also that the mtview.php file is there, right where it should be. Wonder if this is one of those “what’s really the root of the file” thing, where sometimes it’s rooted under /public_html/, sometimes under /dave/, etc. So add /public_html to all the mtview.php refs in the .htaccess file.
- Same error. Rats. Odd, though, that it’s talking about mtviewer.php, not mtview.php. Google. No joy. (I later learn that the mtviewer ref is correct, just misleading in this case.)
Mod_rewrite should be available on the server.
- Look in the php directory referenced. Hey, there’s a directory (tmpl) missing there. Another bad FTP? Dagnabbit, this is getting ridiculous. I’ve already downloaded a demo of the latest WS_FTP — let’s let it give it a go and reload the whole PHP directory.
- Well, I’ll be damned. It worked. Amazing what happens when you fully install the frelling program … (mutter mutter mutter …)
Eyeballing indicates no difference.
So … now what?
Ah …
- Try the same on the individual archives. And monthly archives.
- Huzzah.
So changing all but the index files to dynamic ended up saving about 4Mb in files, with no discernable performance hit. I’m going to try a few further experiments to see what might break under the dynamic stuff before I try it out on my main page, but, for now, I’m pretty happy with it.