Learning Movable Type: HTML or PHP?

This article is out of date and doesn't touch on MT's dynamic publishing features. ~Elise February 22, 2007

When you are first setting up a new weblog, Movable Type prompts you to choose a file extension in the weblog config preferences section. The default setting is HTML.


If your server allows PHP scripts, and you would like to add customization features that aren't part of the default Movable Type system, it is highly recommended that you choose PHP as your default file extension preference in place of HTML. Doing so allows you to take advantage of many freely available PHP scripts to help customize your weblog. PHP is an open source scripting language that is powerful, stable, and extremely popular for adding dynamic elements to websites. In your Movable Type weblog, PHP scripts can allow you to do random photos, includes, and skinning, among many other things. PHP can also help you create a more modular approach to building your templates, thus reducing rebuild times.

To give your entire weblog php extensions, write php in place of html where prompted in the weblog config preferences section. In the weblog config archiving section change the archive file template extensions from html to php. On your index templates, change the extensions of your output files to php. (See the Converting to PHP Tutorial to convert your site to PHP.) If you only want to invoke a PHP script on the Main Index and not on any other pages (for example to generate a random photo on your main page), just change the output file of the template from index.html to index.php. (If you do this, make sure to delete the index.html file from your server (using an FTP program). Left of the server, the index.html file will served instead of the index.php file.)

Cool things to do with PHP:
PHP Skinning Tutorial - Domesticat.net
Random Image Rotation - PHP script from A List Apart
Relative Dates PHP script - change from "Posted Aug 1" to "Posted 3 days ago".

Converting to PHP - LMT Tutorial
An Introduction to PHP by John Coggeshall

Posted by Elise Bauer on April 27, 2004 9:39 PM to Learning Movable Type http://www.learningmovabletype.com/