Is it possible to sort comments first on top
Posted: Tue Jun 20, 2006 9:18 pm
Is it possible to sort comments first on top and new comments at the bottom?
Content management as it is meant to be
https://forum.cmsmadesimple.org/
Code: Select all
<dl>
{php}$initialize = count($items);{/php}
{foreach from=$items item=entry}
<dt class="clearfix">
<span class="counter">{counter start="$initialize" direction='down'}</span>
{if $entry->author_email}
<a href="mailto:{$entry->author_email|escape:"hexentity"}">{$entry->comment_author}</a>
{else}
{$entry->comment_author}
{/if}
said...<br /><span class="date">{$entry->date}</span></dt>
<dd>{$entry->comment_data}</dd>
{/foreach}
</dl>Code: Select all
$query = "SELECT comment_id, comment_author, comment_data, comment_date, author_email, author_website FROM ".cms_db_prefix()."module_comments WHERE page_id = ".$pageid." AND module_name = '".$modulename."' AND active = 1 ORDER BY comment_date desc";
Code: Select all
ORDER BY comment_date descCode: Select all
ORDER BY comment_date ascCode: Select all
$initializecount = count($entryarray);
$this->smarty->assign_by_ref('initializecount', $initializecount);Code: Select all
{foreach from=$items item=entry}
<dt class="clearfix"><span class="counter">{$initializecount}</span>{if $entry->author_email}<a href="mailto:{$entry->author_email|escape:"hexentity"}">{$entry->comment_author}</a>
{else}{$entry->comment_author}{/if} said...<br /><span class="date">{$entry->date}</span></dt>
<dd>{$entry->comment_data}</dd>
{assign var=initializecount value=$initializecount-1}
{/foreach}