殷德瑶博客
喜欢的歌,静静地听!喜欢的人,远远地看!

Emlog判断管理员评论回复用不同的样式

殷德瑶 2015-10-2 emlog教程 评论 2790 次

Emlog默认所有回复的一样,闲来没事,就捣鼓了一些,具体教程如下:首先在当前加入代码函数

$url .=BLOG_URL.''

然后在该判断的地方加入代码

<?php if($comment['url']==$url){?>此处自定义代码函数<?php }?>

举例说明,以默认板子为例:用以下代码直接替换模板文件中module.php中子评论列表

<?php
//blog:子评论列表
function blog_comments_children($comments, $children){
	$url .=BLOG_URL.'';
	$isGravatar = Option::get('isgravatar');
	foreach($children as $child):
	$comment = $comments[$child];
	$comment['poster'] = $comment['url'] ? '<a href="'.$comment['url'].'" target="_blank">'.$comment['poster'].'</a>' : $comment['poster'];
	?>
	<div class="comment comment-children" id="comment-<?php echo $comment['cid']; ?>">
		<a name="<?php echo $comment['cid']; ?>"></a>
		<?php if($isGravatar == 'y'): ?><div class="avatar"><img src="<?php echo getGravatar($comment['mail']); ?>" /></div><?php endif; ?>
		<div class="comment-info">
			<b><?php echo $comment['poster']; ?> </b><br /><span class="comment-time"><?php echo $comment['date']; ?></span>
			<div class="comment-content"<?php if(($comment['url']==$url)||($comment['mail']=='sl@shuyong.net')){?> style="color:#F00;"<?php }?>><?php echo $comment['content']; ?></div>
			<?php if($comment['level'] < 4): ?><div class="comment-reply"><a href="#comment-<?php echo $comment['cid']; ?>" onclick="commentReply(<?php echo $comment['cid']; ?>,this)">回复</a></div><?php endif; ?>
		</div>
		<?php blog_comments_children($comments, $comment['children']);?>
	</div>
	<?php endforeach; ?>
<?php }?>



发表评论


粤ICP备15078261号 Powered by 黑暗之夜
Theme by 殷德瑶博客