[文章目录]显示/隐藏

大家都知道小松的读者墙插件

下载地址:xiaosong.org

插件实现读者墙教程:

1.在核心文件module.php 中添加:

<?php
function reader_wall_side($side){
	$CACHE = Cache::getInstance();
	$user_cache = $CACHE->readCache('user');
	if($side=='1'){
		$time_side = strtotime('last Monday',strtotime('Sunday'));
	}elseif($side=='2'){
		$time_side = strtotime('this month',strtotime(date('m/01/y')));
	}else{
		$time_side = 0;
	}
	$DB = Database::getInstance();
	$userName = $user_cache[1]['name'];
	$sql_side = "SELECT count(1) AS comment_nums,poster,mail,url,comment,gid FROM ".DB_PREFIX."comment where date > $time_side and mail != '' and poster != '$userName' and hide ='n' group by mail order by comment_nums DESC limit 0,6";
	$result_side = $DB->query($sql_side);
	
	while($row_side = $DB->fetch_array($result_side)){
		$img_side = "<img class=\"avatar avatar-36 photo\" width='36' height='36' alt='' src='".cache_gravatar($row_side['mail'])."' />";
		$tmp_side = "<li><a href=\"{$row_side['url']}\" target=\"_blank\" ><img src=\"".cache_gravatar($row_side['mail'])."\" class=\"avatar avatar-46\" height=\"46\" width=\"46\"></a>
						<span class=\"author\" style=\"display:none\"></span>
						<div class=\"detail\">
							<a href=\"{$row_side['url']}\" target=\"_blank\" class=\"author\"><img src=\"".cache_gravatar($row_side['mail'])."\" class=\"avatar avatar-46\" height=\"46\" width=\"46\">{$row_side['poster']}</a>
							<span class=\"count\">总评论数:{$row_side['comment_nums']}</span>
							<a href=\"".Url::comment($row_side['gid'])."\" class=\"recent-comment\">第一次留言:{$row_side['comment']}</a>
							<div class=\"triangle\"><div></div></div>
						</div>
					</li>";
		$output_side .= $tmp_side;
	}
	
	return $output_side;
}
?>


2.把代码中的

cache_gravatar 换成你自己板子的头像函数

3.在需要的位置调用:


<?php echo reader_wall_side(3); ?>  后面“3”为显示数量


4.CSS样式自己各种折腾吧