首页 > SEO优化 > Emlog判断管理员评论回复用不同的样式

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

时间:2023年10月13日 分类:SEO优化 浏览量:121

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 }?>

如对教程有疑问,请直接在下方留言。

觉得文章有用就打赏一下文章作者

微信扫一扫打赏

标签: