Typecho自定义评论样式
可以设置自定义的评论样式,具体代码如下:
<?php
function threadedComments($comments,$singleCommentOptions) {
$imgUrl = Helper::options()->siteUrl . 'usr/themes/thinkH/images/pingback.jpg';
$author = '<a href="'.$comments->url.'" rel="external nofollow" target="_blank">'.$comments->author.'';
$depth = $comments->levels +1;
if($depth<=1){
$size = (int) Helper::options()->commentsPageSize;
$curr = (int) $comments->currentPage;//这个数值为0,暂不清楚是干什么的,但我需要一个输出当前页数的函数!!!
$cn = (int) $comments->sequence;
$n = $cn + $curr*$size;
$floor = 'For All '.$n.' The-FatherC'; // 主楼层
}else{
$floor = ($depth-1).'#InnerC'; // 子楼层
$style = 'style="margin-left:' . ceil(5/$depth) . 'px;"';
}
?>
<li id="<?php $comments->theId(); ?>" <?php if( $depth > 1) echo $style;?>>
<div id="comment-<?php $comments->theId(); ?>">
<div class="comment-body <?php echo 'depth-'.$depth;?>">
<div class="commentmeta <?php echo 'commentmeta-'.$depth;?>"></div>
<div class="comment-author">
<?php
$tLC = (Helper::options()->ShGravatar)?(Helper::options()->ShGravatar):0;
if ($tLC == 0) {
?>
<?php include("include/avatar.php"); ?>
<?php }else{?>
<?php $comments->gravatar(32, 'identicon', 'X', 'avatar'); ?>
<?php } ?>
<cite class="fn"><?php commentApprove($comments, $comments->mail); ?><?php echo $author; ?></cite>
<span><?php $comments->date('Y-m-d H:i:s') ?></span>
<span class="subcolor">This</span><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 elseif($comments->sequence == 4): ?>门口
<?php elseif($comments->sequence == 5): ?>走廊
<?php elseif($comments->sequence == 6): ?>楼梯
<?php elseif($comments->sequence == 7): ?>宅院
<?php elseif($comments->sequence == 8): ?>小区
<?php elseif($comments->sequence == 9): ?>街道
<?php else: ?>
第<?php $comments->sequence(); ?>号大院<?php endif; ?>
<?php endif; ?>
</span><span class="subcolor"><?php echo $floor; ?></span>
<span class="comment-reply">
<?php $comments->reply('reply'); ?>
</span>
<div class="subcolor ">
[<?php GetBrowser($comments->agent)?> @ <?php GetOs($comments->agent)?>]
</div>
</div>
<div class="comment_content"><?php $comments->content(); ?></div>
</div>
<div class="children">
<?php if ($comments->children) { ?><?php $comments->threadedComments($singleCommentOptions); ?><?php } ?>
</div>
</div>
</li>
<?php
}
?>
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »