代码由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><?phpglobal $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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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']."><p><img alt='' src=".myGravatar($row['mail'])." 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'])." 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');?>

评论列表