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 }?>
如对教程有疑问,请直接在下方留言。
代码如下:
<?php
//blog:子评论列表
function blog_comments_children($comments, $children){
$url .=BLOG_URL.'';
$isGravatar = Option::get('isgravatar');
foreach($children as $child) {
$comment = $comments[$child];
$comment['content'] = preg_replace("/{smile:(([1-4]?[0-9])|50)}/",'<img src="' . TEMPLATE_URL. 'ui/images/smilies/$1.gif" />',$comment['content']);
$comment['poster'] = $comment['url'] ? '<a href="'.$comment['url'].'" rel="nofollow" target="_blank" class="upps">'.$comment['poster'].'</a>' : $comment['poster'];
?>
<ol class="children">
<a name="<?php echo $comment['cid']; ?>"></a>
<li id="comment-<?php echo $comment['cid']; ?>" class="comment byuser comment-author-benz odd alt depth-2">
<article id="div-comment" class="comment-body">
<footer class="comment-meta">
<div class="comment-author vcard">
<?php if($isGravatar == 'y'): ?>
<img alt='' src='<?php echo getGravatar($comment['mail']); ?>' class='avatar avatar-70 wp-user-avatar wp-user-avatar-70 alignnone photo' height='70' width='70' /><?php endif; ?>
<b class="fn"><?php echo $comment['poster']; ?></b><span class="says"> 说道:</span> </div><!-- .comment-author -->
<div class="comment-metadata">
<a>
<time datetime="<?php echo $comment['date']; ?>">
<?php echo $comment['date']; ?>9 </time>
</a>
</div><!-- .comment-metadata -->
</footer><!-- .comment-meta -->
<div class="comment-content">
<p><?php echo $comment['content']; ?></p>
<?php echo useragent($comment['useragent']); ?>
</div><!-- .comment-content -->
<div class="reply">
<?php if(($comment['url']==$url){?> style="color:#F00;"<?php }?>>
<a class="comment-reply-login" href="#comment-<?php echo $comment['cid']; ?>" onclick="commentReply(<?php echo $comment['cid']; ?>,this)">回复</a> </div><!-- .reply -->
</article><!-- .comment-body -->
</li><!-- #comment-## -->
<?php blog_comments_children($comments, $comment['children']);?>
</ol><!-- .children -->
<?php } ?>
<?php }?>