嗯,2天没有写东西了,这两天在调教BLOG程序中唉,各种问题多多,不过还好,一切顺利,嗯,修改了不少,
其中就有评论样式哦,话说,Typecho资料是够少啊,官方的更是少,不少都得自己动手,不过不怕,自己动手,丰衣足食嘛,嗯,言归正传,
Typecho 0.8后评论就只有一句代码
<?php $comments->listComments(); ?>
|
嗯,官方说明,这是美化版的评论(这里->官方说明)
但是,对我们来说,不能DIY是件很苦恼的事情哇,所幸,官方说明上有说,可以自己定义
可是说明够简单,就1个例子,中间的所有云云,都得自己写哇,只好查,结果网上真有查到,
在彼岸云雨,有一段,可是我按照说明COPY却依然不正确,最后,改了下参数,竟然正确了,下面是我改过的哦
function threadedComments($comments, $singleCommentOptions) { global $hasLog; $commentClass = ''; if ($comments->authorId) { if ($comments->authorId == $comments->ownerId) { $commentClass .= ' comment-by-author'; } else { $commentClass .= ' comment-by-user'; } } $commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; ?> <li id="<?php $comments->theId(); ?>" class="comment-body<?php if ($comments->levels > 0) { echo ' comment-child'; $comments->levelsAlt(' comment-level-odd', ' comment-level-even'); } else { echo ' comment-parent'; } $comments->alt(' comment-odd', ' comment-even'); echo $commentClass; ?>"> <div class="comment-author"> <?php $comments->gravatar($singleCommentOptions->avatarSize, $singleCommentOptions->defaultAvatar); ?> <cite class="fn"> <span class="ua_author"><?php $singleCommentOptions->beforeAuthor();$comments->author();$singleCommentOptions->afterAuthor(); ?></span> </cite> </div> <div class="comment-meta"><a href="<?php $comments->permalink(); ?>"><?php $singleCommentOptions->beforeDate();$comments->date($singleCommentOptions->dateFormat);$singleCommentOptions->afterDate(); ?></a> </div> <p><?php $comments->content(); ?></p> <div class="comment-reply"> [<?php $comments->reply($singleCommentOptions->replyWord); ?>] </div> <div class="clear"></div> <?php if ($comments->children) { ?> <div class="comment-children"> <?php $comments->threadedComments($singleCommentOptions); ?> </div> <?php } ?> </li> <?php } ?>
|
不同之处,在于 threadedComments 所带参数不同,嗯,改下就可以了,如果大家有同样错误可以试一下这个哦……
PS.从留言来看,他原来的程序应该没有错误哦,我的应该是小众错误吧,嗯,就这样子哦……
评论
Twikoo V1.6.31