<?php $this->widget('Widget_Comments_Recent')->to($comments); ?>
<?php while($comments->next()): ?>
<a href="<?php $comments->permalink(); ?>"><?php $comments->excerpt(20, '[...]'); ?></a></br><span><?php $comments->author(false); ?>于<?php $comments->date('Y-m-d H:i'); ?>评论</span>
<?php endwhile; ?>
这是一段调用最新评论的代码,我在我的2个博客中都使用了,但是2个博客点击的链接却不一样,如:
A博客:http://www.a.com/1.html#comment-1
B博客:http://www.b.com/1.html/comment-page-1#comment-12
正因为这2个链接不一样,导致进入后的页面肯定也是不一样的,A博客进入后的页面只显示了评论,而且滚动条无法向上滚动来查看对应的内容,但是B博客可以。如图:
点击B博客的链接进入的也是评论,但是可以通过滚动条向上查看这篇文章的内容,不知道A为什么不行,求解。
注:2个代码都是放在index.php的侧栏文件测试的。