Emlog评论添加楼层及子楼层
-
0
154

开发主题的时候用到,分享给大家
1.在模板中module.php文件中找到评论列表函数
function blog_comments($comments)
替换为
function blog_comments($comments,$params)
2.找到$isGravatar = Option::get('isgravatar');并在后面添加代码
$comnum = count($comments);
foreach($comments as $value){
if($value['pid'] != 0){
$comnum--;
}
}
$page = isset($params[5])?intval($params[5]):1;
$i= $comnum - ($page - 1)*Option::get('comment_pnum');
3.找到评论列表尾部
<?php endforeach; ?>
替换为
<?php $i--;endforeach;?>
4.在你想调用地方添加
<?php echo $i.'楼'; ?>
5.修改子评论
<?php blog_comments_children($comments, $comment['children']); ?>
替换为
<?php blog_comments_children($comments, $comment['children'],$i,0); ?>
接下来找到
$comment = $comments[$child];
在下面添加
$x=$x+1;
再把这个
function blog_comments_children($comments, $children)
替换为
function blog_comments_children($comments, $children,$i,$x)
继续找
<?php blog_comments_children($comments, $comment['children']); ?>
替换
<?php blog_comments_children($comments, $comment['children'],$i,$x); ?>
最后在你想加的位置添加
<?php echo $i.'-'.$x.'楼'; ?>
文章页的调用方式
<?php blog_comments($comments);>
替换为
<?php blog_comments($comments,$params); ?>