tips and tricks for movable type

smart comments
March 24, 2002

Customizing your comment display based on how many there are.

<MTEntryIfAllowComments><a href="<$MTCGIPath$>mt-comments.cgi?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false">
<script language="Javascript">
<!--
if (<$MTEntryCommentCount$> == 0)
{
document.write('Add your comment!')
} else if (<$MTEntryCommentCount$> == 1)
{
document.write('<$MTEntryCommentCount$> comment')
} else if (<$MTEntryCommentCount$> > 1)
{
document.write('<$MTEntryCommentCount$> comments')
}
//-->
</script></a>
</MTEntryIfAllowComments>

Updated 10.19.02 for latest version of MT OpenComments function.

The SSI method is described in this Forum topic, and the PHP version can be found in this one.

Updated 07.09.02: Adam Kalsey offers a tutorial on how to do this without server side scripting or Javascript - but you must have the Regex plugin created by Brad Choate!

Updated 12.09.02: Another example of using Regex found in this topic.

Updated 12.15.02: And yet another topic with an example using MTIfEmpty.

Comments

Using MTIfEmpty plugin I made a cool thing on my site that shows an emtyp clickable ballon if there are no comments and a "full" clickable balloon with a comment count if there are comments. thanks for your help.

by hubs | 04.21.03 05:25 PM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 0
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/2)