Typecho Wiki
每一个作品都值得被记录

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

Typecho维基君Typecho教程 • 1541次浏览 • 发布 2018-05-18 • 更新 2018-05-18
极致加速的V2Ray 助您畅享全球网络 & 搬瓦工VPS最新优惠码
🛜自用大流量超低月租手机卡推荐榜单 #拒绝流量焦虑
<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>

广告声明:文内含有的对外跳转链接(包括不限于超链接、二维码、口令等形式),用于传递更多信息,节省甄选时间,结果仅供参考,Typecho.Wiki所有文章均包含本声明。
本文检索关键词:Typecho教程
厂商投放

【腾讯云】🎉五一云上盛惠!云服务器99元/月续费同价!

腾讯云五一劳动节海量产品 · 轻松上云!云服务器首年1.8折起,买1年送3个月!超值优惠,性能稳定,让您的云端之旅更加畅享。快来腾讯云选购吧!

广告
添加新评论 »