Stopping Movable Type from truncating long templates

This one goes out to all those fickle fans who stumble here via Google.

If you use Movable Type 4 and have any very long templates you may have encountered a problem where saving the template in MT’s editor results in the end of your template being cut off.

I’ve finally discovered (via a message to ProNet by Brad Choate in April 2008) that this happens if your MT install was originally version 3. These days MT4 stores the template text in a MySQL column of type MEDIUMTEXT, which can store 16MB. MT3 used type TEXT which can only store 64K.

The various upgrade processes between then and now have failed to include this change. So if you find your long templates are being truncated you may want to apply this command to your MySQL database:

ALTER TABLE mt_template MODIFY template_text MEDIUMTEXT;

Obviously, do so at your own risk, etc, etc. I’ve no idea if there are other columns that should be similarly adjusted. Or why this has been neglected by upgrade processes. But it fixes this particular problem.

(Thanks to Adam Rice for pointing me at the solution.)

Comments

  • I’ve had the same problem with entry fields on a site, and this seems to be the problem there as well (with field entry_text on mt_entry) - a copy of MT which was brand new on MT4 has the field set to MEDIUMTEXT. The MT upgraded from MT3 has it as TEXT.

    I’m going to try altering the table for this field - see what happens!

21 Oct 2008 at Twitter