分享一个emlog非插件实现读者排行榜的方法

2015-8-2 / 0 评论 emlog / Mrxn

本文共计 5768 字,感谢您的耐心浏览与评论.

代码由flyercn分享,本站只做转载登记之用,代码可能要自己稍稍修改才能使用,如有疑问,留言咨询,这个创建一个文件,例如:comtop.php,把代码放入这个文件中,然后直接把这个文件放入网站根目录即可。


<?php //读者墙汇总页面
require_once 'init.php';
define('TEMPLATE_PATH', TPLS_PATH.Option::get('nonce_templet').'/');
$CACHE = Cache::getInstance();
$options_cache = $CACHE->readCache('options');
extract($options_cache);
$navibar = unserialize($navibar);
$curpage = CURPAGE_HOME;
$site_title = "分享一个emlog非插件实现读者排行榜的方法";
$site_key = 'emlog评论者排行榜';
$site_description = '统计访问舍力博客且有留言的网友,前9名评论者有外链,已经去除作者和无链接者评论';
include View::getView('header');
?>
<style>
.dzq{margin:auto;margin:10px 0 0-10px;}
.dzq ul{clear:both;overflow:hidden;}
.dzq ul li{width:33.333333333333333%;float:left; line-height:20px; }
.dzq ul li dd{border:1px solid #ccc;clear:both;overflow:hidden;margin:0 0px 5px 10px;background:url(vip.png) no-repeat left -1px}
.dzq ul li p{float:left;margin:10px 10px 10px 10px;}
.dzq1{margin:auto; margin-left:-5px;}
.dzq1 ul{width:8.333333333333333333333333%;float:left;}
.dzq1 ul li{border:1px solid #ccc;margin:5px 0 5px 5px;clear:both;overflow:hidden;}
.dzq1 ul li p{text-align:center; margin-top:5px;}
.dzq1 ul li h4{text-align:center; height:25px; overflow:hidden; line-height:25px;}
.sm{clear:both;overflow:hidden; font-size:14px; border:1px solid #ccc; padding:10px;}
</style>
<?php
global $CACHE;$user_cache = $CACHE->readCache('user');$name = $user_cache[1]['name'];
$DB = MySql :: getInstance();
$sql = "SELECT count(*) AS comment_nums,poster,mail,url FROM ".DB_PREFIX."comment where date >0 and poster !='".$name ."' and url!='' and hide ='n' group by poster order by comment_nums DESC limit 0,200";
$result = $DB -> query($sql );$x=1; while($row = $DB -> fetch_array($result ) )if ($x<=1) {{if($row['url']){$tmp = "
<ul><li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第一名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></li></dd>";
}else{$tmp = $img;}$output .= $tmp;$x++;}}elseif($x<=2){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第二名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=3){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第三名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=4){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第四名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=5){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第五名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=6){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第六名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=7){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第七名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=8){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第八名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li>";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x<=9){if($row['url']){$tmp = "
<li><dd><a target=\"_blank\" href=".$row['url']." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow" ><p><img alt='' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /></p>
<h4>第九名:".$row['poster']."<br />在本站共评论".$row['comment_nums']."次<br />".$row['url']."</h4></a></dd></li></ul></div><div class=\"dzq1\">";
}else{$tmp = $img;}$output .= $tmp;$x++;}elseif($x>=10){$img = "";
 if($row['url']){$tmp = "
<ul><li><a target=\"_blank\" href=\"".BLOG_URL."go/?url=".$row['url']."\" title=\"【第".$x."名】 评论:".$row['comment_nums']."\"><p><img alt='".$row['poster']."' src=".myGravatar($row['mail'])." rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  rel="external nofollow"  height=\"40\" width=\"40\" /><p><h4>".$row['poster']."</h4></a></li></ul>";
}else{$tmp = $img;}$output .= $tmp;$x++;}
$output = '
<div class="sm">说明(以下链接的来源,仅显示前200名评论者;顺序:留言数 —> 最新评论者):<br />
在舍力博客随便一篇文章中留言(图像为Gravatar),通过审核即可上榜。<br />
排名为留言次数最多(审核通过的次数),前9名评论者加红显示,已经去除作者和无链接者评论</div>
<div class="dzq">'.$output .'</div>';
echo $output ;?>
<?php include View::getView('footer');?>


标签: emlog

转载:转载请注明原文链接 - 分享一个emlog非插件实现读者排行榜的方法


0条回应:“分享一个emlog非插件实现读者排行榜的方法”


发表评论

{view_code_no}