AVR32 Linux Developer Blog

Function: RenderRecentComments

Render the list of recent comments in the WebSideBar

The maximum age of a BlogComment to be displayed is hardcoded below in epoch seconds. See the age="2592000" parameter below. Customize it to

  1. month: 2592000
  2. months: 5184000
  3. months: ...

as you like. The reason for that is to fade out old comments and even don't display the comments section in the sidebar at all if your blog grows lonely. It is no good advertisement to display very old comments in this prominent position with obiously no newer comments than that.

Parameters

  • LIMIT: maximal number of comments to list
  • CAT: restrict scope to the given SubjectCategory

Implementation

%STARTINCLUDE%
*~~
%~~ RECENTCOMMENTS{
~~~   category="%CAT%"
~~~   header="$n<noautolink>$n
*~~     <div class=\"blogSideBarSection blogSideBarComments\">
~~~     <table class=\"blogSideBarHeader\" 
~~~            border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">
~~~       <tr><td>
*~~         <h1>
*~~           Comments$percntREDDOT{\"%WEB%.%TOPIC%\"}$percnt
*~~         </h1>
*~~       </td><td align=\"right\">
*~~        <a class=\"natFeedIcon\"
~~~           title=\"RSS Feed for the Comments on this Site\"
~~~           href=\"%SCRIPTURL{"view"}%/%WEB%/WebRssComments\">RSS</a>
*~~       </td></tr>
*~~     </table>
~~~     <table width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"
~~~   format="<tr>
~~~     <td><ul style=\"margin-top:0px;margin-bottom:0px;\"><li>
~~~       <a href=\"%SCRIPTURL{"view"}%/$web/$topic\"
~~~          title=\"permalink to <nop>$topic\">$headline</a> <br/>
~~~       <span class=\"blogSideBarCommenter\">
~~~         $percntTIMESINCE{\"$date\" format=\"$time ago\"}$percnt
~~~         $commenter replied
~~~       </span></li></ul>
~~~     </td>
~~~     <td valign=\"top\" class=\"blogCommentCount\">
~~~       <a href=\"%SCRIPTURL{"view"}%/$web.$topic#topComment\"
~~~          title=\"comments on <nop>$topic\">
*~~         $percntCOUNTCOMMENTS{\"$web.$topic\" hidenull=\"on\"}$percnt
*~~       </a>
~~~     </td></tr>"
~~~   limit="%LIMIT%" age="2592000"
~~~   footer="</table></div>$n</noautolink>"
~~~ }%
*~~
%STOPINCLUDE%

Test

Calls to 'RenderRecentComments'

TopicForm
TopicType: TopicFunction
TopicDescription: Render the list of recent comments in the WebSideBar
r1 - 2006-01-03 - 17:27:07 - TWikiContributor
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
Atmel®, AVR® and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries.
All other trademarks are the property of their respective owners.