wet_recent_comments: Textpattern plugin lists recent comments

30. Mai 2006

wet_recent_comments is a Textpattern plugin which lists recent comments, both per article and site wide.

It is a single tag which lists a limited amount of the most recent comments, optionally including the comment message. It is context sensitive: When wet_recent_comments is used in a page template, comments are taken from all articles, while in an article form comments are specifically chosen from the ones concerning the current article.

Options include:

  • Limit word count in comment message
  • Strip HTML from comment message
  • Plus the common attributes wraptag, break, class, and labeltag

Usage

<txp:wet_recent_comments />
  • Display the ten most recent comments in the format <cite>Commenter's name</cite> (article title).
<txp:wet_recent_comments limit="5" showcomment="yes"
maxwords="25" striptags="yes" />
  • Display the five most recent comments in the format <cite>Commenter's name</cite> (article title)<p>comment message</p>.
  • Limit comment message to a maximum of 25 words plus a trailing ellipsis when appropriate.
  • Strip all HTML tags from the message.
<txp:wet_recent_comments dateformat="on %B, %d" />
  • Display the ten most recent comments in the format <cite>Commenter's name</cite> <span>on MONTHNAME, DAY</span> (article title)<p>comment message</p>.

NB: (article title) is ommited when this tag is used in an article context.

Required attributes

None.

Optional attributes

attribute description default
limit Maximum number of comments to display. 10
showcomment Show comment message (yes/no). no
striptags Strip HTML from comment message (yes/no). no
maxwords Truncate messages at this word count and append an ellipsis. 50
dateformat If present, the comment’s date is included in the output. The string is printed literally with some special formatting codes being replaced by the actual values: Empty
class class attribute which will be applied to the to the wraptag. wet_recent_comments
wraptag (X)HTML tag used to enclose the list. See the Textpattern User Manual for further reference. ul
break This string will be used to separate list items. See the Textpattern User Manual for further reference. li
label This string will be prepended to the list. See the Textpattern User Manual for further reference. Empty
labeltag (X)HTML tag used to enclose the label. See the Textpattern User Manual for further reference. Empty

Credits

wet_recent_comments is based on rei_recent_comments, a plugin by Reinier Ladan.

Special thanks go to our Creative Director h. c. Matthias Schlecker, who happens to be the master mind behind hauptstadtblog.de, for inspiring the context sensitivity feature and brave pre-release testing.

Licence

This plug-in is released under the Gnu General Public Licence.

Download

Get it here: wet_recent_comments.txt.

Change log

Date Version Notes
2006-05-30 0.2 Initial public release
2006-06-08 0.3 Obey comments moderation status
2006-06-08 0.4 Customizable comment date display: dateformat attribute