MT-Preview

There is a Movable Type plugin called mt-preview which I like, and with the update to MT3.2 the instructions for modifying MT to use this plugin are now outdated. Therefore, I post this to help anyone googling around for an answer with respect to MT-Preview and Movabletype3.2.

The location to upload the file is the same, but the MT templates are different - so this is what I did. I used the command line, but one could just have easily used FTP, though it would have taken longer.

First, I backed up the files I was to modify cp edit_entry.tmpl edit_entry_original.tmpl cp entry_actions.tmpl entry_actions_original.tmpl

Then, I modified edit_entry.tmpl. This part is the same as before.

Somewhere in the section where the functions are defined, I added the function: function doPreview () { window.open('<TMPL_VAR NAME=SCRIPT_PATH>mt-preview.cgi?blog_id=<TMPL_VAR NAME=BLOG_ID>&entry_id=<TMPL_VAR NAME=ID>', '', 'width=600,height=500,resizable=yes,scrollbars=yes'); }

The window.open bit is on one line.

then in entry_actions.tmpl I found the line

<TMPL_IF NAME=ENTRY_EDIT>

and added this, immediately afterwards. <TMPL_UNLESS NAME=NEW_OBJECT> <input class="button" onClick="doPreview()" type="button" value="<MT_TRANS phrase="WYSIWYG">"> </TMPL_UNLESS>

What has happened here is that Sixapart spotted that the button code appeared twice in the first template, as the buttons could appear at the top or bottom of the edit_entry screen, and so they removed this code into another file, so one edit will do the job.