楼层初始化
<?php
$floor = 1; // 初始化楼层为1
$db = Typecho_Db::get();
$sql = $db->select()
->from('table.comments')
->where('table.comments.cid = ?', $comments->cid)
->where('table.comments.status = ?', 'approved')
->order('table.comments.created', Typecho_Db::SORT_ASC);
$result = $db->fetchAll($sql);
foreach ($result as $row) {
if ($row['created'] < $comments->created) {
$floor++;
}
}
$floorText = $floor == 1 ? '1个脚印' : ($floor == 2 ? '2楼' : ($floor . '楼'));
?>
<span class="reply joe_comment__reply" data-id="<?php $comments->theId(); ?>" data-coid="<?php $comments->coid(); ?>">
<?php echo '第' . $floorText; ?>
</span>
在主题目录下打开 comment.php 文件(参考路径:usr/themes/Joe/public/comment.php),在合适的位置(比如作者后面、或者是评论者后面都可以)添加以上代码。
楼层板凳
<span style="margin-left:5px;color:#617d0e;font-size:12px">
<?php if($comments->levels == 0): ?>
<?php if($comments->sequence == 1): ?>沙发
<?php elseif($comments->sequence == 2): ?>板凳
<?php elseif($comments->sequence == 3): ?>地毯
<?php else: ?>
第<?php $comments->sequence(); ?>楼<?php endif; ?>
<?php endif; ?>
</span>
...
在主题目录下打开 comment.php 文件(参考路径:usr/themes/Joe/public/comment.php),在合适的位置(比如作者后面、或者是评论者后面都可以)添加以上代码。