可以在每篇文章下面显示几条评论,也没啥鸟用

<?php
/**
* 评论列表
*
* @author Mr.Asong
* @link http://mrasong.com
*/
$slug = $this->slug;    //页面缩略名
$limit = 3;    //调用数量
$length = 30;    //截取长度
$ispage = true;    //true 输出slug页面评论,false输出其它所有评论
$isGuestbook = $ispage ? " = " : " <> ";
 
$db = $this->db;    //Typecho_Db::get();
$options = $this->options;    //Typecho_Widget::widget('Widget_Options');
 
$page = $db->fetchRow($db->select()->from('table.contents')
->where('table.contents.status = ?', 'publish')
->where('table.contents.created < ?', $options->gmtTime)
->where('table.contents.slug = ?', $slug));

if ($page) {
$type = $page['type'];
$routeExists = (NULL != Typecho_Router::get($type));
$page['pathinfo'] = $routeExists ? Typecho_Router::url($type, $page) : '#';
$page['permalink'] = Typecho_Common::url($page['pathinfo'], $options->index);
 
$comments = $db->fetchAll($db->select()->from('table.comments')
->where('table.comments.status = ?', 'approved')
->where('table.comments.created < ?', $options->gmtTime)
->where('table.comments.type = ?', 'comment')
->where('table.comments.cid ' . $isGuestbook . ' ?', $page['cid'])
->order('table.comments.created', Typecho_Db::SORT_DESC)
->limit($limit));


if (empty($comments)) {  
    echo ''; 
} else {  
        echo '<div class="commlist">';  
        foreach ($comments AS $comment) {  
        echo '<li><span class="right">' . date('m/d', $comment['created']) . '</span><b>' . $comment['author'] . ':</b>';  
        echo Typecho_Common::subStr(strip_tags($comment['text']), 0, $length, '...');  
        echo '</li>';  
    }  
        echo '</div>';  
}  
} 
?>

用阿松写的这段代码,修改
$slug = "message"; //页面缩略名
改成
$slug = $this->slug; //页面缩略名

评论时间就是$comment['created_at'],这是unix时间戳,转换成人类看得懂的时间date('Y-m-d H:i:s', $comment['created_at'])

可以将此代码保存为 commlist.php 文件,首页直接调用