Typecho 不用插件的方法制作读者墙

<ul class="toggle webshot">
<?php
$period = time() - 2592000; // 時段: 30 天, 單位: 秒
$counts = Typecho_Db::get()->fetchAll(Typecho_Db::get()
->select('COUNT(author) AS cnt','author', 'url', 'mail')
->from('table.comments')
->where('created > ?', $period )
->where('status = ?', 'approved')
->where('type = ?', 'comment')
->where('authorId = ?', '0')
->group('author')
->order('cnt', Typecho_Db::SORT_DESC)
->limit(6)
);
$mostactive = '';
$avatar_path = Helper::options()->siteUrl . 'usr/img/avatar/';
foreach ($counts as $count) {
  $avatar = $avatar_path . md5(strtolower($count['mail'])) . '.jpg';
  $c_url = $count['url']; if ( !$c_url ) $c_url = Helper::options()->siteUrl;
  $mostactive .= "<li class='mostactive'>
  <a href='" . $c_url . "' title='" . $count['author'] . " (" . $count['cnt'] . "comments)'>
  <img src='" . $avatar . "' alt='' class='avatar'/></a></li>\n";
}
echo $mostactive; ?>
</ul>

广告栏+++++++蜜糖商店|大哥云| 搬瓦工JMS|红莓网络| Mielink|萌喵加速| 飞鸟云

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注