Moving from Movable Type to Textpattern

Jun 16, 04:35 PM

Intro

This article is about my experience converting two Movable Type (MT) blogs to Textpattern (TXP). It’s not a step-by-step how-to, more a guide to (hopefully) help you along the way.

Background

Recently I took advantage of a fantastic web-hosting offer by hosting startup TextDrive. This truly was an offer too good to refuse: lifetime TextDrive membership for the cost of one year’s hosting. The money paid by those who took up this offer (the so-called “VC200”) was used to supply the company’s startup funds.

One of the TextDrive guys is Dean Allen of Textile fame. He’s been working on a CMS called Textpattern which came pre-installed on my TextDrive space, so I decided to give it a go in lieu of the venerable MT which I’ve been using for about a year. Of course, there’s loadsa controversy around MT 3.0’s new licensing options and even though I was happy with MT and could still use the free version, I’d been thinking about switching to TXP for a while, mainly because I admire Textile and wanted to see what Dean came up with in Textpattern. Here was the perfect opportunity. I decided to move my two blogs over when I moved to TextDrive.

About The Blogs

My blogs are very simple: a single author and not very big. When I transferred, neither had more than one hundred entries. I was using MT 2.551 with a Berkeley DB back-end and posting to them through the web interface (no bookmarklets or offline composers like Zempt). I was transferring to Textpattern (TXP) g1.19 and a MySQL backend.

My blogs each live in their own sub-directory of the HTML doc root. One is your basic blog (whatever comes into my head) and the other is a reviews site. For example purposes, let’s say the blog lives under /journal/ and the reviews site lives under /analysethis/. Let’s further assume that on the server, the full path to the HTML doc root is /usr/home/frodo/public_html. I wanted each blog to be under:

/usr/home/frodo/public_html/journal/
/usr/home/frodo/public_html/analysethis/

Transfer Considerations

  • When transferred to TXP, I wanted the blogs to look the same or similar; to the casual viewer it should appear that nothing had changed. For now I’m happy with the way my sites look; later, I’ll explore TXP’s formatting capabilities as the styling features look quite interesting.
  • Within MT it’s easy to maintain multiple sites from within a single installation of the MT package; TXP doesn’t do multiple sites this way. To achieve the same you need a separate copy of the TXP package for each blog1. This also means two separate MySQL databases or using table prefixes. I decided to use two databases.

Thing I Didn’t Do

  • I made no attempt to translate links to archived MT articles. I couldn’t think of a way to translate MT 2.551’s links to the “clean URLs” of Textpattern. Besides, I don’t have many links to archived articles.

How I Transferred

With the above in mind, here’s how I transferred. If you’re going to use this as a guide I suggest reading through to the end before haring off and converting your sites!

(1) Exported each blog. These were used later as input to a TXD import script; they also provided a backup of my blogs. To export: log into MT, select a site, choose Export and save to disk.

(2) “Textiled” the contents, i.e., converted HTML markup to Textile markup. This step is optional. My MT entries had a lot of hand-coded HTML because I’m used to HTML markup and had no effective alternate markup MT plug-in. I did have Brad Choate’s Textile plug-in but found it failed to correctly interpret my Textile markup. Anyway, I thought it’d be nice to Textile my entries and found the following was fairly safe:

  • replace <em>, </em> with ”_” (underscore);
  • replace <strong>, </strong> with ”*” (asterisk);
  • replace <cite>, </cite> with ”??” (double question mark);
  • replace <sub>, </sub> with ”~” (tilde);
  • replace <sup>, </sup> with ”^” (caret);
  • replace <blockquote> with “bq.” and </blockquote> with nothing.

A few things to note:

  • Do the Textiling on a copy of the original exports;
  • The import script (see below) doesn’t apply Textile to titles so if any contain HTML markup coverted to Textile markup you’ll see odd results;
  • watch out for weird URLs. I had one which contained a lot of odd characters and it stuffed up the whole article because Textile interpreted them as markup.

(3) Changed the image locations. A lot of my entries had img tags like this:

<img src="/mt/images/misc/TheRealKibitzer.gif" alt="The REAL Kibitzer!"/>

Here I simply replaced “/mt/images/misc/” with “images/” because my new images directory is directly under the site root.

(4) Created a new, blank MySQL database for each blog. I used myPhpAdmin for this, the tool supplied by my hosting provider (TextDrive—go sign up now!). On my host database names require a fixed prefix – let’s say it was “disc”—so my databases were imaginatively named “disc-txp” and “disc-txp2”. They can be anything you want.

(5) Setup directories on my host for each blog. Using the examples above, they’d be like this:
/usr/home/frodo/public_html/journal
/usr/home/frodo/public_html/analysethis

(6) Under each directory just setup, install TXP. I put the software into directory /textpattern so ended up with
/usr/home/frodo/public_html/journal/textpattern
/usr/home/frodo/public_html/analysethis/textpattern

In theory you could put TXP any place and have the config files point there. However I had trouble getting my sites to recognise the CSS stylesheets until I put TXP under the subdirectories—the CSS link seemed to ignore any other place.

(7) Created TXP config files with the correct settings. This doesn’t have to be done now—in fact the TXP setup prompts you for the contents of “config.php”—but I already knew what TXP wanted so had them ready in advance. Using the “/usr/home/frodo/public_html/journal/” directory as an example, here’s what I setup:
(Note: you only need the “about” and “article” files if you want “clean URLs” in TXP)















FileLocationContents
config.phpunder textpattern directory
<?php
$txpcfg['db'] = 'disc-txp';
$txpcfg['user'] = 'disc';
$txpcfg['pass'] = 'gd764hhjjhdud9s';
$txpcfg['host'] = '';
$txpcfg['table_prefix'] = '';
$txpcfg['txpath'] = '/usr/home/frodo/public_html/journal/textpattern';
$txpcfg['doc_root'] = '/usr/home/frodo/public_html';
$txpcfg['secret_word'] = 'frodo';
?>
aboutsite root
<?php
include "./textpattern/config.php";
$s = "about";
include $txpcfg['txpath']."/publish.php";
textpattern();
?>
articlesite root
<?php
include "./textpattern/config.php";
$s = "article";
include $txpcfg['txpath']."/publish.php";
textpattern();
?>
index.phpsite root
<?php
include 'textpattern/config.php';
include $txpcfg['txpath'].'/publish.php';
textpattern();
?>

(8) Fired up TXP and ran the setup procedures. I won’t go into detail here since it’s fairly straightforward. Don’t forget, though, that if you create the config files as per the previous step, chances are you can ignore the setup script’s creation of the config.php file.

(9) Logged in to TXP set up site preferences (Admin | Preferences).

Note: I stuffed up at this point. I think I changed the “Time offset (hours)” to match my local timezone, meaning that the offset was applied to my MT entries by the import script: suggest you leave it as zero.

(10) Downloaded the import script and placed it into the /textpattern directory for each site. I got the script from the Textpattern forum; it was written by ramanan and can be downloaded from his site. The original forum post is also handy as he may have updated it.

(11) Placed my MT exports into into the /textpattern directory for each site to be accessible to the import script.

(12) Took a deep breath and ran ramanan’s import script. Don’t forget to read all the info the script gives you before running. In particular, remember to run ”_update.php” after it finishes. Mine produced output like this:

Moveable Import Script

1. Importing post... Created user 'frodo'. Ghost Ship... inserting 2. Importing post... Created user 'frodo'. Thir13en Ghosts... inserting 3. Importing post... Created user 'frodo'. Dungeons and Dragons... inserting . . . 97. Importing post... Created user 'frodo'. Alien <sup>3</sup>... inserting 98. Importing post... Created user 'frodo'. Cypher... inserting 99. Importing post... Created user 'frodo'. 28 Days Later... inserting 100. Importing post... Created user 'frodo'. Heat Guy J... inserting All done. Have fun!

(13) Checked a few of entries to make sure they looked OK. If you find you have trouble with the time offset I can give you an SQL to fix it.

(14) At this point I had two functional blogs operating under my domain. They used the default TXP styling, which is very elegant, but I wanted my sites to look similar to their MT incarnations. This is where the hard work comes in. If you’re a web designer, this part is probably the most essential and most fun for you—personalising the site’s look and feel. For me it was about getting the thing as close as possible to someone else’s design—one of the MT defaults, in fact.

So, I offer my first efforts at getting TXP to look like MT! I haven’t finished re-tooling my sites so these are still a work in progress. Make of them what you will and feel free to change or hack them as required.

The “default” page view it
The “archive” page view it
The “default” form view it
New form “site-header” view it
New form “site-nav” view it
The “default” stylesheet    view it

And that’s about it for now. Good luck with your Textpattern adventures!

1 Note: I’ve seen posts that there’s other ways to do this, that you can run multiple sites from within a single TXP but this way worked best for me. I vaguely recall it’s something to do with PHP prepend but I can’t remember whether this was on the Texpattern or TextDrive forums…

Permalink |



  1. Jason Hoffman    Jun 17, 10:48 AM    #

  2. Sarah    Jun 17, 01:59 PM    #

  3. D    Jul 19, 07:14 AM    #