13 Apr, 2002
How to have your comments line say different things depending on the number of comments
Posted by: Jennifer In: How to's
Long how to description… simple script.
(This script is specific to MT)
In Javascript:
<script language=javascript>
<!–
document.write('<a href="<$MTEntryLink$>#comments">')
if (<$MTEntryCommentCount$> == 0)
{
document.write(<b>'speak up</b></a>')
} else if (<$MTEntryCommentCount$> == 1)
{
document.write('<$MTEntryCommentCount$> <b>voice</b></a>')
} else if (<$MTEntryCommentCount$> > 1)
{
document.write('<$MTEntryCommentCount$> <b>voices</b></a>')
}
//–>
</script>
or in PHP:
<?
print('<a href="<$MTEntryLink$>#comments">');
if (<$MTEntryCommentCount$> == 0)
{
print('speak up</a>');
} else if (<$MTEntryCommentCount$> == 1)
{
print('<$MTEntryCommentCount$> voice</a>');
} else if (<$MTEntryCommentCount$> > 1)
{
print('<$MTEntryCommentCount$> voices</a>');
}
?>