EMLOG评论排行榜完整代码更新

emlog教程 2年前 (2019) Mgo
0
记录一下,评论排行榜完整代码,参考DUX大前端整理出来的。

php代码放在module.php文件内,HTML和CSS代码放在指定文件呢,或者CSS放在公用CSS内。

EMLOG评论排行榜完整代码更新

PHP

	
  1. <?php
  2. //单页排行榜
  3. function guest($num){
  4. global $CACHE;
  5. $user_cache = $CACHE->readCache('user');
  6. $name = $user_cache[1]['name'];
  7. $i = 0;
  8. $DB = Database::getInstance();
  9. $sql = "SELECT count(*) AS comment_nums,poster,mail,url FROM ".DB_PREFIX."comment where date >0 and poster !='". $name ."' and poster !='' and hide ='n' group by poster order by comment_nums DESC limit 0,$num";
  10. $log_content = $content[1];
  11. if(strpos($log_content, '[READERWALL-WEEK]') > -1) {
  12. $cur_time_span = strtotime('last Year',strtotime('Sunday'));
  13. }
  14. $result = $DB -> query( $sql );
  15. while($row = $DB -> fetch_array($result)){$i++;
  16. if($i<=3 ){
  17. if($i==1){
  18. $mingpai = '金牌';
  19. }else if($i==2){
  20. $mingpai = '银牌';
  21. }else if($i==3){
  22. $mingpai = '铜牌';
  23. }
  24. $tmp = "<li><a rel=\"external nofollow\" target=\"_blank\" href=\"" . $row[ 'url' ] . "\" title=\"" . $row[ 'poster' ] ."(".$mingpai.")\"><img alt=\"avatar\" src=\"" . getGravatar($row['mail']) . "\"><em id=\"iv".$i."\">" . $row[ 'poster' ] ."</em><strong id=\"iv".$i."\">".$mingpai."</strong></a></li>";
  25. }else{
  26. $tmp = "<li><a rel=\"external nofollow\" target=\"_blank\" href=\"" . $row[ 'url' ] . "\" title=\"" . $row[ 'poster' ] ."\" ><img alt=\"avatar\" src=\"" . getGravatar($row['mail']) . "\"><em>" . $row[ 'poster' ] ."</em><strong>+" . $row[ 'comment_nums' ] . "</strong></a></li>";
  27. }
  28. $output .= $tmp;
  29. }
  30. $output = ''. $output .'';
  31. return $output ;
  32. }
  33. ?>

Html

	
  1. <div class="Single-king">
  2. <div class="king-title">登上榜单,让您成为众多网友关注的焦点!</div>
  3. <div class="king-content">
  4. <ul>
  5. //挂载点
  6. <?php echo guest(51); ?>
  7. </ul>
  8. </div>
  9. </div>

Css

	
  1. <style>
  2. .Single-king{overflow: hidden;position: relative;border: 1px solid #ddd;}
  3. .Single-king .king-title{border-bottom: 1px solid #eeeae7;line-height: 30px;font-size: 14px;color: #ff4d7b; padding-left: 10px;}
  4. .Single-king .king-content{position: relative;overflow: hidden;padding: 5px;}
  5. .king-content ul{overflow:hidden;margin:0 auto;padding:0}
  6. .king-content ul li{display:inline-block;width:33%}
  7. .king-content ul a{position:relative;display:block;overflow:hidden;margin:0 4px;padding:4px 4px 4px 44px;height:40px;border:1px solid #eaeaea;color:#999;line-height:32px;text-decoration:none}
  8. .king-content ul img{float:left;margin:0 8px 0 -38px;width:30px;height:30px;border:3px #fff solid;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(34,25,25,.5)}
  9. .king-content ul em{position:absolute;overflow:hidden;margin-right:10px;width:50%;height:36px;color:#999;text-overflow:ellipsis;white-space:nowrap;font-style:normal;transition:all .2s ease-out}
  10. .king-content ul strong{position:absolute;right:8px;width:20%;color:#999;text-align:right}
  11. .king-content ul #iv1 {color: #f44336;}
  12. .king-content ul #iv2 {color: #03A9F4;}
  13. .king-content ul #iv3 {color: #4caf50;}
  14. </style>


版权声明:Mgo 发表于 2019-03-22 14:14:17。
转载请注明:EMLOG评论排行榜完整代码更新 | 站长聚集地

暂无评论

暂无评论...