Importing DotComments

January 15, 2003 - updated February 8, 2006

MovableType allows you to import entries and comments that have been exported by other blogging applications. If your are a Blogger user who has used dotComments to allow commenting on your posts, this article describes how you can import your comments into MovableType. You can do this even if you’ve already imported your entries and you only need to add the comments


To get started, you have to configure and upload a dotexport.php file. Copy the following text into Notepad and change the $src_dir value to the absolute path to the directory where your blog is located (and your dotcomments script resides). Save the file as “dotexport.php” and upload it to your web server into the same directory where dotcomments resides.


$src_dir = '/home/johndoe/www/blog/';

// Functions

/* Prints comments in MovableType export format
AUTHOR: John Doe
DATE: 05/16/2002 06:17:15 PM
I love how this comments got exported so nicely!
function exportMTComments($commentID) {
    $comments_path = "${src_dir}comments/";
    if($file = @fopen($comments_path . "$commentID.comment", 'r')) {
        $comments = trim(fread($file, '1000000'));
        if($comments) {
            $comments = explode("\n", $comments);

    if($comments) {
        for($i = 0; $i < sizeof($comments); $i++) {
            $thisComment = explode('[+]', stripslashes($comments[$i]));
            $body = str_replace("<br>", "\n", $thisComment[3]);
            echo "-----\n";
            echo "COMMENT:\n";
            echo "AUTHOR: " . $thisComment[1] . "\n";
            echo "EMAIL: " . $thisComment[2] . "\n";
            echo "IP: " .  $thisComment[5] . "\n";
            echo "URL: " . $thisComment[4] . "\n";
            echo "DATE: " . date("m/d/Y h:i:s A", $thisComment[0]) . "\n";
            echo $body . "\n";

Blogger Entry Template

Next, you’ll need to follow the first eight export steps described on the MovableType website but using one of the following templates. If you have not yet imported anything from Blogger into MovableType, use the first template bellow which will import both your entries and comments. If you had already imported the Blogger entries and you now want to import corresponding dotComments, use the second template instead.

Importing Blogger Entries and DotComments
<Blogger>TITLE: <PostSubject><$BlogItemSubject$></PostSubject>
AUTHOR: <$BlogItemAuthor$>
DATE: <$BlogItemDateTime$>
<? exportMTComments(<$BlogItemNumber$>); ?>
Importing DotComments Only
<Blogger>NO ENTRY: 1
DATE: <$BlogItemDateTime$>
<? exportMTComments(<$BlogItemNumber$>); ?>

Blogger Archive Template

After finishing the first eight steps described on the MovableType website, go to the Archive section in blogger. Click on “Archive Template”. Backup your current archive template and replace it with the following:

<? $src_plaintext=1; include("dotexport.php"); ?><Blogger><? include("<$BlogArchiveLink$>"); ?></Blogger>

Save the template and click on “Archive Settings”. Set the “Archive Frequency” to “Monthly” and specify “export_archive.php” as the “FTP Archive File Name”.

Got to “Archive Files” and click on “Republish All”. Blogger will generate the archive files that will be ready for import.

Exporting Entries

To retrieve the Blogger export of your comments (and entries) go to your blog but instead of your blog name, use “export_archive.php”, i.e. You can then save that file to disk and proceed with importing entries as described by MovableType.