Where

- home
- wiki
- moblog
- about
- fun stuff
- dj
- dvds
- books
- recipes
- siteinfo


When

Who


Warning: Invalid argument supplied for foreach() in /home/gblake/include/blogroll.class.php on line 40
Powered by Bloglines

< Skype for OS X | Main | I wonder if the is the Infocom one >

August 31, 2004

Movable Type 3.1: Dynamic Templates

One of the cool new things in Movable Type 3.1 (which should be out pretty damn soon now) is the dynamic PHP publishing. Why is this a big thing? Because up till now if you'd changed a something like your individual archive page template you'd have to go back and rebuild your whole site. If you've got a large number of posts this tends to take a while. Now, it can just render the page when requested, which means doing a pushlish all will go much faster.

After a few rough starts, I got the whole thing running on this blog. The index page and the feeds are all static, but any archive page is built up on the fly. And you can even turn on a caching if you so desire. When you do this, a copy of the dynamic page is kept around for an hour so that if someone else visits that page again within the hour it doesn't have to rebuild it again from the database.

Setup for this feature was actually much easier than I thought, once you know a few things. One, it doesn't work if you are using Berkeley DB as your database. Which required me to convert to using mySQL. Which worked out okay overall, but I had to do a bit of tweaking since I seemed to have some odd corruption in my database. Once that was done I just had to turn on the dynamic publishing for the templates I wanted and create a templates_c directory in my blog's home directory. One republish later and everything was working just fine. It's pretty much transparent to the person browsing the site (which means your existing permalinks won't change at all.

It also lets you do caching of the dynamicly generated pages via the Smarty template engine. If you turn it on, dynamicly generated pages are cached for an hour by default (though you can tweak that if you need to). Pretty slick. While my site doesn't generate a ton of traffic, this is the kind of thing that could really be useful for a site that gets tons of hits a day.

One or two other gotchas. If you are using PHP you can't use opening tags in the format <?, you need to have them in the format <?php. As long as you do that you shouldn't have any issues. Also, this is supposedly not compatible with any other plugins (not an issue for me as I don't use any other plugins).

Another issue is how dynamic pages are built. I tend to do my template editing locally using cyberduck+subethaedit and I have my templates linked to a local file on my web server. I find it is much easier to edit them that way. The problem with this is that if you make a change to the local file, you need to go back into MT and save it there also for it to take affect. I personally think it should make a check to see if the file version has changed and load that one in if so.

Next thing to try: doing more with categories and sub-categories (You can see a bit of a preview to the right).

Posted by snooze at August 31, 2004 01:27 PM

Comments

Thanks for the latest informative info on MT 3.1. I'm anxiously awaiting its release!

Posted by: Carla [TypeKey Profile Page] at August 31, 2004 01:56 PM

Post a comment

LJ Users: You can now sign on via openID. Please enter the URL to your LiveJournal in the following space. For example, http://www.livejournal.com/users/yourLJnamehere.


Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?