Archive for the ‘PHP’ Category
First of all I’m using the broader definition of hacking. I don’t mean illegally breaking in to. I mean to use programming expertise to glean more functionality out of.
Movable Type published static pages (HTML) from the information you provide and re-publishes those static pages whenever it detects a change (a new post, a comment, etc.)
However, it’s possible to also include some dynamic content. The first step would be to change the type of page from HTML to PHP (or whatever scripting page your server runs, that you know how to use). To do that log in to the MT dashboard and go to Preferences>>Publishing and under Publishing Options change the File Extension for Archive Files to php (or whatever extension is used for the type of script you’ll be using.
Then go to Design>>Templates and change the filenames on all Index Templates so they’ll have the correct extension.
To give a simple example we can change our individual posts to only output the comments when the comment link it used. First make sure that the comment permalink is there in addition to the usual permalink, and the comment permalink has ?comments=yes#comments on the end. (the comments=yes sets a variable we’ll use with the script. The #comments directs the browser to the top of the comments)
Go to Archive Templates and then Individual Entry Archive.
Find where the comments start. It should be a div that looks like…
<a name="comments"> </a> <MTIfCommentsActive> <div id="comments">
…just above it add the following…
<?php
if($_GET['comments']=='yes')
{
?>
…Now we’ll look for the end of the div. This can be pretty hard since typically ending divs are not marked. But, it should look something like…
</MTEntryIfCommentsOpen> </div>
Right after it insert the following…
<? } ?>
Once this is done, republish the archives.
Now when someone goes to the individual post using the regular permalink, the comments won’t appear. It’ll only be when they click on the comments link that the page will reload, and show the comments. This will save some bandwidth by not showing comments unless someone specifically wants to.
Obviously this blog is done on WordPress. My other active blog, JackLewis.net is done on Movable Type. My wife’s blog, Linda’s Thoughts (which I set up for her is also on Movable Type). I’ve worked extensively with both, so I feel I can look at the pros and cons objectively.
Movable Type is the older platform, initially released in 2001. It’s based on Perl and provides static page, rebuilt whenever any change is made to the content.
Word Press is somewhat younger, starting in 2003. It’s based on PHP and generates all pages dynamically.
Having programmed in both Perl and PHP and can tell you that while Perl is a more flexible programming language for the expert, PHP comes very close, and is much, much easier to manage. So unless you plan on never, ever having the code tweaked, (or have someone handy who knows Perl very well) PHP is the better choice of the two.
The reasoning behind Movable Types static/rebuild method is that the server would do less work. In reality it turns out to be just the opposite. I’ve done several MT=>WP conversion of larger blogs because the CPU simply couldn’t handle the massive rebuilds required. However, on some of those rebuilds the client later asked about a caching plugin, to further reduce CPU usage, and Movable Type offers a dynamic option–one which I’ve never been able to get to work–however.
Both have excellent backend management systems, as well as tons of plug-ins to expand the functionality of the scripts. Installation is equally difficult on both (or easy, depending on your perspective) and the available templates are equally attractive, however I seem to find more WordPress templates available than Movable Type.
One big factor for me, however, was my purchase of Artisteer, which can create WordPress templates very easily. In all honesty the templating creation process for both left a lot to be desired, from a designer’s standpoint. Artisteer put WordPress far ahead.
I’m still battling WordPress’s bad habit of doing funky things to some text, something which has affected me, many of my clients and others seeking help. I never had that problem with Movable Type.
So there are the pros and cons. That should help you make the decision for your needs.

I've
been developing web sites for over 12 years. I started with HTML, moved on
to Perl and now do mostly PHP with a lot of MySQL and Javascript as well.