Learning Movable Type: Dynamic Publishing - Pros and Cons

Discussion cross posted on Movalog and Learning Movable Type

One of the key features that Six Apart promotes about Movable Type is MT's ability to publish dynamically. What is dynamic publishing? And what are the benefits (and downsides) to dynamic publishing over static publishing?

Elise Bauer, editor of Learning Movable Type, and Arvind Satyanarayan, author of Movalog, discuss some of the pros and cons of dynamic publishing. Non-techie luddite-wannabe Elise shies away from anything that seems like it might not be worth the effort and so far hasn't even tried dynamic publishing. Plugin creator and MT hack-master Arvind has embraced dynamic publishing with his usual boundless enthusiasm. Let's see if he can convince Elise...

ELISE: Okay Arvind, let's start with the basics. From what I understand, dynamic publishing means that the weblog's pages are created "on the fly" when a request is made of the server. The blog pages don't actually exist on the server as individual pages as they do with static publishing.

ARVIND: Yes, that's right. With dynamic publishing the server sends a request to the mtview.php file that serves the appropriate template from the database. More information can be found here.

ELISE: Does dynamic publishing put more load or less load on my server than static publishing?

ARVIND: Well that depends. Rebuilding a big blog with many entries and comments could put a tremendous load on a weak server and the same is the case with dynamic publishing. With dynamic publishing, each request accesses the database to pull the post and comments and depending on your server this could create a load, that's why 6A recommends not using it for the high traffic pages like your main index, but using it instead on lower traffic pages like individual and category archives. For the average Joe blogger however, the load this creates is negligible.

ELISE: A lot of the visitors to my various weblogs come in from Google searches. I thought Google didn't like dynamic pages and doesn't index them as often as static pages. Will Google find my MT dynamically generated pages as easily as my static pages?

ARVIND: When we say Google doesn't like dynamic pages we mean those dynamic pages that typically have long urls with question marks and ampersands (for example mt.cgi?__mode=view&_type=entry). With MT's dynamic publishing, you still maintain proper permalinks that make sense (in fact with dynamic publishing, you permalinks could remain the same). The only difference when switching to dynamic publishing is that the files don't physically exist on the server, Google won't know the difference! To understand this better, read Phil's humourous explanation.

ELISE: It seems that the main reason Six Apart implemented dynamic publishing was to address the concerns of many users that the rebuild times for MT blogs were too slow. I have nine blogs and more than a thousand entries and I've never been bothered by the rebuild times. Still I could see where it may be helpful for sites for which rebuilding is an issue.

ARVIND: I love the rebuild times after switching to dynamic publishing. My 5 blogs with thousands of entries now rebuilds under a minute -- this is with all archives set to dynamic. One must also realize that the dynamic publication is useful when one is tweaking templates and you don't have to rebuild at all, you just make the change, hit save and the change is live!

ELISE: Still, rebuild time is not an issue for me. What are some things I could do with my blog if I had dynamic publishing set-up?

ARVIND: One of the biggest Pros about dynamic publication is that all MT tags are PHP, hence you can use PHP within the tags (you couldn't do this before). Some excellent examples of what dynamic publishing is capable of are the various pagination examples Chad Everett has.

ELISE: That's pretty cool, what else?

ARVIND: Well due to the fact that MT's dynamic engine is based on Smarty, you've got all the Smarty functions available to you, for example, you could use Smarty's obfuscate function to obfuscate email address against spam bots. Also you can use any of the Smarty plugins available, just make sure you upload it to php/plugins/.

ELISE: Well, I see how that could be useful for certain templates in certain situations.

ELISE: If you wanted to use dynamic publishing you would need the following:

1. The permissions of your mt.cfg need to be set to 644, not 600.

2. The ability to process PHP version 4 on your server.

3. The ability to create/add to an htaccess file on your server.

4. MySQL as your database.

Anything else we should know about? Are there any "gottchas"?

ARVIND: There are cons to dynamic publishing. One of the biggest cons I've found is that almost all the plugins that are available for MT will not work with the dynamic system. This is because the plugins were written in Perl while the dynamic system uses PHP. As a result the plugins will need to be ported to the PHP system. However, as I mentioned before, you can use any of the Smarty plugins.

At the moment, the dynamic system is also very young, there are several features lacking (e.g. a PHP port of Storable for plugins that store some information). Also currently dynamic publishing is restricted to MySQL. I assume that in the future these features will be expanded to support all the tags and the rest of the SQL databases (there isn't any hope for you Berkeley DB users!)

Finally another con is that in the case of a database failure, you will lose everything unless you have a backup. With static publishing, you would have physical files that you could run through some scripts to get your posts back but with dynamic publishing, you'll lose everything, hence the importance of backups (see Backing Up Your Blog).

ELISE: It seems like a pain to set up. I hate messing around with htaccess.

ARVIND: It used to be more difficult. Now MT creates or adjusts the htaccess file for you automatically. You do need to have MySQL, PHP. And the error messages can be a bit obscure. I've written a tutorial on those.

ELISE: Well, it looks like if you really need to shorten your rebuild times, and the optimization tips Jay gave don't do it for you, OR you really need one of the features that dynamic publishing lets you do AND you aren't using any plugins or if you have you are using their dynamic ports, THEN you might find dynamic publishing useful. I'm not convinced I need it however. At least not at the moment.

ARVIND: You may not need it, however I like the fact that the dynamic publishing puts me in a PHP environment. If you like coding with PHP, dynamic publishing will be a dream, it makes PHP very easy to work with!

Further Reading:
Troubleshooting Smarty Errors - Arvind's tutorial on Smarty errors
Dynamic Publishing: PHP Architecture Overview

Have an opinion about MT's dynamic publishing system? Please weigh-in in the comments!

Posted by Elise Bauer on May 28, 2005 8:34 AM to Learning Movable Type http://www.learningmovabletype.com/