tips and tricks for movable type
smart comments (revisited)
July 09, 2002
Adam Kalsey offers a tutorial on how to have "smart comments" without server side scripting or Javascript - but you must have the Regex plugin created by Brad Choate!
Code Sample:
<MTAddRegex name="reply0">s|>0 replies|>Reply|g</MTAddRegex>
<MTAddRegex name="reply1">s|>1 replies|>1 reply|g</MTAddRegex>
...
<MTEntries lastn="10" regex="reply0 reply1">
<h1><MTEntryTitle></h1>
<p><MTEntryDate format="%B %e, %Y"> -
<MTEntryIfAllowComments>
<a href="<MTEntryLink>"><MTEntryCommentCount>
replies</a>
</MTEntryIfAllowComments></p>
<p><MTEntryBody></p>
</MTEntries>
<MTAddRegex name="reply1">s|>1 replies|>1 reply|g</MTAddRegex>
...
<MTEntries lastn="10" regex="reply0 reply1">
<h1><MTEntryTitle></h1>
<p><MTEntryDate format="%B %e, %Y"> -
<MTEntryIfAllowComments>
<a href="<MTEntryLink>"><MTEntryCommentCount>
replies</a>
</MTEntryIfAllowComments></p>
<p><MTEntryBody></p>
</MTEntries>
Related Links:
• MT Manual on Plugins
• Original post on the MT Support forum
• Original entry on Smart Comments in this blog
• Original post on the MT Support forum about the Regex plugin
• A different Regex example from the MT Support forum