## January 12, 2007

### MTValidate 0.5

In my quest to improve the user experience hereabouts, I decided to convert this MovableType installation to FastCGI. I’ll explain what’s involved in that in another post, but I did run into a nasty stumbling block: the MTValidate plugin, that we rely on heavily, was incompatible with FastCGI.

It was not (at first) apparent why MTValidate was failing in a FastCGI environment; there were lots of crufty bits of W3C Validator code, which I thought might be the culprits. So I engaged in a lot of code clean-up until I eventually figured out that the problem was its use of IPC::Open3, which is not compatible with FastCGI.

Once I knew what the problem was, it was easy to fix (as written, there was no good reason for the W3C Validator code to be using IPC::Open3 in the first place). But, along the way, I found that I had

• Cleaned up the code considerably.
• Trimmed the prerequisites a little further.
• Made it an MT-3.x-aware plugin.

Time to release a new version.

Posted by distler at January 12, 2007 11:15 PM

TrackBack URL for this Entry:   http://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/1105

### Re: MTValidate 0.5

thanks for new version :)

Posted by: Chip Martins on January 13, 2007 3:51 PM | Permalink | Reply to this

### Re: MTValidate 0.5

Thanks for doing that. I tried FastCGI last month and found the problem with MTValidate but didn’t have time to investigate.

Posted by: Zack on January 14, 2007 11:34 PM | Permalink | PGP Sig | Reply to this

### Re: MTValidate 0.5

Has anyone tried to use MTValidate to validate new entries in addition to comments? I’m assuming this would require either hacking the MT source or a version of MTValidate as a back-end plugin for the New Entry screen. How difficult would this be to accomplish?

Thank you in advance for any feedback.

Posted by: boblet on March 1, 2007 11:14 PM | Permalink | Reply to this

### Validating Entries

We do precisely that on the blogs I host here on Golem.

Just as with comments, when you preview an entry, it gets run through the Validator.

Posted by: Jacques Distler on March 2, 2007 12:37 AM | Permalink | PGP Sig | Reply to this

### Re: Validating Entries

Thank you for your reply Jacques. I was hoping you were going to say that!

Is there any chance you could explain how you did so? (you knew that was coming didn’t you :-)

Posted by: boblet on March 2, 2007 5:51 AM | Permalink | Reply to this

### Re: Validating Entries

Yes, I know that was coming.

When I originally did this, the only way to do it was to modify the Application itself, since the template for the entry-preview page was embedded in the application.

Specifically, it’s in lib/MT/App/CMS.pm around line 7495. If you look at my omnibus patch file, for MT 3.3x, you can see exactly what I did and where I did it. I added the line

$ctx->stash('blog_id',$blog_id);

at line 7499 and then replaced

<p><b><$MTEntryTitle$></b></p>
<$MTEntryBody$>
<$MTEntryMore$>

with

<MTValidate>
<$MTInclude module="DTD"$>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h3 class="title"><$MTEntryTitle smarty_pants="2"$></h3>
<div>
<$MTEntryBody smarty_pants="2"$>
<hr />
<$MTEntryMore smarty_pants="2"$>
</div>
</body>
</html>
</MTValidate>
<MTValidateIfValid> <h3 class="title"><$MTEntryTitle smarty_pants="2"$></h3> <div> <$MTEntryBody smarty_pants="2"$> <hr /> <$MTEntryMore smarty_pants="2"$> </div> </MTValidateIfValid>

Nowadays, I believe it is possible for a plugin to customize the template code for the entry preview page. But I have never gotten around to revisiting this bit of code and seeing whether I can replace it by a plugin.

Posted by: Jacques Distler on March 2, 2007 8:00 AM | Permalink | PGP Sig | Reply to this

### Re: Validating Entries

Thanks for the directions - I’d downloaded the patch but had yet to look at it. If you ever revisit it and decide to make a plugin/extend MTValidate, I’d love to hear about it!

To tell the truth I’m a little surprised there still don’t seem to be any blog/CMS tools that do this by default. Shouldn’t it be easier than this?

Posted by: boblet on March 3, 2007 8:38 AM | Permalink | Reply to this

### This should be…

To tell the truth I’m a little surprised there still don’t seem to be any blog/CMS tools that do this by default.

Shouldn’t it be easier than this?

See the Wiki software I’m working on. Reliably well-formed XHTML(+MathML+SVG) output, whatever the user happens to type.

If you want something done right …

Posted by: Jacques Distler on March 3, 2007 9:27 AM | Permalink | PGP Sig | Reply to this

### Re: This should be…

If you want something done right …

Great! All I have to do now is learn to program - should be easy to whip up a CMS that understands internationalization and does standards too!!

Sigh.

Posted by: boblet on March 9, 2007 3:37 AM | Permalink | Reply to this