Emlog评论排行页面代码

2017-9-26 0 PHP代码 蓝优


以下教程由蓝优网转载发布

1.备份一份page页面改名为contact  找到

<?php echo $log_content; ?>
在下面添加代码:
<?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  poster !='匿名' and hide ='n' group by poster order by comment_nums DESC limit 0,280";
$result = $DB -> query( $sql );
$x=1; 
while( $row = $DB -> fetch_array( $result ) )
if ($x<=1) {
{
$img = "";
 if( $row[ 'url' ] )
{$tmp = "<a target=\"_blank\" href=\"/go.php?url=". $row[ 'url' ] ."\" title=\"".$row[ 'poster' ]." - 共有 ". $row[ 'comment_nums' ] ."\"><img alt='' src=".getGravatar( $row[ 'mail' ]) ." class=\"avatar avatar-36 photo\" height=\"36\" width=\"36\" /></a>";
}
else
{$tmp = $img;}
$output .= $tmp;
$x++;
}
}elseif($x<=2){
$img = "";
 if( $row[ 'url' ] )
{$tmp = "<a target=\"_blank\" href=\"/go.php?url=". $row[ 'url' ] ."\" title=\"".$row[ 'poster' ]." - 共有 ". $row[ 'comment_nums' ] ." 条评论\"><img alt='' src=".getGravatar( $row[ 'mail' ]) ." class=\"avatar avatar-36 photo\" height=\"36\" width=\"36\" /></a>";
}
else
{$tmp = $img;}
$output .= $tmp;
$x++;
}elseif($x<=3){
$img = "";
 if( $row[ 'url' ] )
{$tmp = "<a target=\"_blank\" href=\"/go.php?url=". $row[ 'url' ] ."\" title=\"".$row[ 'poster' ]." - 共有 ". $row[ 'comment_nums' ] ." 条评论\"><img alt='' src=".getGravatar( $row[ 'mail' ]) ." class=\"avatar avatar-36 photo\" height=\"36\" width=\"36\" /></a>";
}
else
{$tmp = $img;}
$output .= $tmp;
$x++;
}elseif($x>=4){
$img = "";
 if( $row[ 'url' ] )
{$tmp = "<a target=\"_blank\" href=\"/go.php?url=". $row[ 'url' ] ."\" title=\"".$row[ 'poster' ]." - 共有 ". $row[ 'comment_nums' ] ." 条评论\"><img alt='' src=".getGravatar( $row[ 'mail' ]) ." class=\"avatar avatar-36 photo\" height=\"36\" width=\"36\" /></a>";
}
else
{$tmp = $img;}
$output .= $tmp;
$x++;
}
$output = '<section class="container"><div class="content no-sidebar">
 <header class="article-header">
 </header><div class="readers">'. $output .'</div></section>';
echo $output ;
 ?>
 <style>
.container{max-width:1200px;margin:0 auto;text-align:left;position:relative;*zoom:1;}
.container{max-width:1200px;margin:0 auto;text-align:left;position:relative;*zoom:1;}
.container:before,.container:after{display:table;content:"";line-height:0}
.container:after{clear:both}
.no-sidebar{margin-right: 0;}
.article-header{padding:0 0 12px;border-bottom: 1px solid #f2f2f2;margin-bottom: 20px;text-align: center;  }
.article-header .text-muted{font-size: 12px;margin-bottom: 0;}
.article-title{font-size: 26px;margin-top: 5px;line-height: 1.2;}
.article-title a{color: #444;}
.article-title a:hover{color: #FF5E52;text-decoration: underline;}
.content-wrap{width:100%;float:left;}
.content {
    margin-left: 0;
    margin-right: 0;
    min-height: 500px;
    padding: 15px 20px;
}
.avatar {float: none;    position: relative;
    width: 100%;
    height: auto;
    margin-bottom: 15px;
    margin-left: -5px;
    box-shadow: 10px 10px 20px -15px rgba(0,0,0,.3),-10px 10px 20px -15px rgba(0,0,0,.3);
    box-shadow: 0 4px 5px 0 rgba(0,0,0,.14),0 1px 10px 0 rgba(0,0,0,.12),0 2px 4px -1px rgba(0,0,0,.2)!important;}
.readers{overflow: hidden;}
.readers a{width: 72px;margin: 0 5px 25px 5px;float: left;text-align: center;color: #999;font-size: 12px;height: 65px;text-decoration: none;}
.readers a:hover{color: #FF5E52;}
.readers .avatar{    border-radius: 100%;
    margin-left: 0px;
    border: 3px solid #F2F5F7;
    width: 52px;
    height: 52px;}
.readers a.item-top {background-color: #f6f6f6;border-radius: 5px;color: #bbb;height: 90px;margin: 0 1% 30px;padding: 10px 10px;text-align: left;width: 29%;}
.readers a.item-top .avatar{float: left;margin-left: 10px;margin-right: 10px;}
.readers a.item-top h4{color: #FF5E52;font-size: 16px;}
.readers a.item-top strong{display: block;color: #666;}
.readers a.item-top:hover{background-color: #f1f1f1;}
.readers a.item-2 h4{color: #7CCD38;}
.readers a.item-3 h4{color: #52BAF5;}
.affix {position: fixed;}
</style>
2.上传contact.php 后台新建页面更改page为contact 完成


标签: EMLOG教程 转载
版权声明:若无特殊注明,本文皆《蓝优》原创,转载请保留文章出处。
本文链接:Emlog评论排行页面代码 - http://www.92mo.cn/daima/16.html

发表新评论

快捷功能: