Documentation
This function is used to render a section in a sidebar listing the recent comments last month
limitted to a max of 10 by default. To fetch the list of most recent comments there are two
implementations below: one using DBQUERY and METACOMMENT and the other using SOLRSEARCH. The
latter is used automatically when SolrPlugin is installed.
Parameters
- LIMIT: max number of comments to show
- CAT: retrieve recent comments on BlogEntries in that category
- MONTHS: age of comments to display by number of months, defaults to 1
Implementation
%STARTINCLUDE%<noautolink>
%METACOMMENTS{
web="%BASEWEB%"
topic="%HOMETOPIC%"
search="State!='unpublished' %IF{"defined CAT and '%CAT%'!=''" then="AND topic ISA '%CAT%'"}%"
sort="date"
reverse="on"
approved="on"
mindate="%DATETIME{delta="%MONTHS{default="1"}% month ago" lang="en"}%"
limit="%LIMIT{default="10"}%"
header="<div class='blogSideBarSection'>
<h2 >%IF{"defined CAT and '%CAT%'!=''"
then="%TRANSLATE{"Comments in [_1]" args="%CATINFO{cat="%CAT%" format="$title"}%"}%"
else="%TRANSLATE{"Comments"}%"
}%</h2>
<ul>"
format="<li>
<a href='$permlink'>
$percntTMPL:P{\"comment::photo\"
web=\"%USERSWEB%\"
topic=\"$author\"
align=\"right\"
}$percnt
$percntTRANSLATE{\"[_1] replied on [_2] [_3]\"
args=\"<strong>$percntSPACEOUT{$author}$percnt</strong>, “$percntGETTOPICTITLE{\"$web.$topic\" encode=\"entity\"}$percnt”, $percntCALCULATE{\"$FORMATTIME($timestamp, $day& $mon& $year)\"}$percnt\"
}$percnt
%CLEAR%
</a>
</li>"
footer="</ul></div>"
separator="$n"
}%<!-- -->
</noautolink>%STOPINCLUDE%
Test