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>
<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.