Help - Search - Members - Calendar
Full Version: greymatter-like dynamic comment link
Movable Type Community Forum > Additional Resources > Tips and Tricks
kadyellebee
In addition, if you want to use SSI or Javascript, this thread has several great suggestions, as well as another version of a PHP way to display comments with different titles.

Just thought I'd add this smile.gif

Kristine
LunarMagic
MT has only one code for linking to the comments... and I wanted something like my old greymatter journal where it would only say how many comments there were if there were more than one, etc.

This script I wrote in PHP... it shows "Comment" if there's no comments, "Comment (1)" if there's 1 and "Comments (N)" if there's two or more.

CODE
<?
$c = <$MTEntryCommentCount$>;
if ($c < 1) {
print('<a href="<MTEntryLink>#comments">Comment</a>');
}
else {
if ($c == 1) {
print('<a href="<MTEntryLink>#comments">Comment (1)</a>');
}
else {
if ($c > 1) {
print('<a href="<MTEntryLink>#comments">Comments (');
print($c);
print(')</a>');
}
}
}

?>


Hope someone else finds it useful. =)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.