当前位置:网站首页 > 更多 > 站长帮 > 正文

[Emlog教程] Emlog读者墙美化代码

作者:CC下载站 日期:2018-10-10 04:04:36 浏览:2014 分类:站长帮

EMLOG读者墙美化代码适用于创建单页或放置侧边栏


[Emlog教程] Emlog读者墙美化代码


将以下代码放到MODULE.PHP核心文件中

<?php 
function guest($num){
	global $CACHE;
	$user_cache = $CACHE->readCache('user');
	$name = $user_cache[1]['name'];
	$DB =Database::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,$num";
	$log_content = $content[1];
if(strpos($log_content,'[READERWALL-WEEK]')>-1){
		$cur_time_span = strtotime('last Year',strtotime('Sunday'));
}
	$result = $DB -> query( $sql );
while($row = $DB -> fetch_array($result)){
		$img ="<li><a rel=\"external nofollow\" target=\"_blank\" href=\"". $row['url']."\" title=\"". $row['poster']."(赐教". $row['comment_nums']."次)\"><img  alt=\"avatar\"  src=\"". getGravatar($row['mail'])."\" class=\"avatar\"><em>". $row['poster']."</em><strong>+". $row['comment_nums']."</strong></a></li>";
if( $row['url']){
			$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>";
}else{
			$tmp = $img;
}
		$output .= $tmp;
}
	$output =''. $output .'';
return $output ;
}
?>

CSS

ul.readers-list{overflow:hidden;margin:0auto;padding:0;}
ul.readers-list li{display:inline-block;width:20%;}
ul.readers-list a{position:relative;display:block;overflow:hidden;margin:04px;padding:4px4px4px44px;height:40px;border:1px solid #eaeaea;color:#999;text-decoration:none;line-height:32px;}
ul.readers-list img{float:left;margin:08px0-38px;width:30px;height:30px;border:3px#fff solid;border-radius:50%;background:#fff;box-shadow:01px3px rgba(34,25,25,.5);}
ul.readers-list em{position:absolute;overflow:hidden;margin-right:10px;width:50%;height:36px;color:#000;text-overflow:ellipsis;white-space:nowrap;font-style:normal;transition:all .2s ease-out;}
ul.readers-list strong{position:absolute;right:8px;width:20%;color:#999;text-align:right;}

挂载调用适当位置

<ul class="readers-list"><?php echo guest(100);?></ul>


您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯