Comments off code

I don’t do it very often, but every once in a while I don’t allow comments. Until today I couldn’t figure out how to have the words ‘Comments off’ show up whenever I turned comments off. This of course has been bugging me because, well, I’m that sort of goofy.

I finally leafed through the MT manual* and discovered the MTEntryFlag. Using this and a little PHP (the same PHP snippet I keep using the hell out of) I finally figured out how to accomplish this.

Just in case anyone is interested:

The actual value returned by the MTEntryFlag is commented out so it won’t show on the blog.

<!—<$MTEntryFlag flag=“allow_comments”$>—>
if (<$MTEntryFlag flag=“allow_comments”$> == 0) {
?>Comments off<? } ?>

This should go right before the MTComments code.

*Seriously, you’d think I’d be better about reading manuals and instructions. It really would save me a great deal of trouble.

Posted on 12/07 at 02:57 AM in Geek_Speak

This work is licensed under a Creative Commons License.
Plagiarism makes babies cry.