预览
思路
查库,typecho_comments
表,这次我没有用之前的 push 方式来获取Winget
对象,继承了Widget_Abstract_Comments
类,可以直接使用Typecho_Widget::widget()
方法来调用对象,比较符合Typecho的设计思路。重写了翻页代码,完美支持翻页。
核心代码
调用方式
和平常的Widget_Abstract_Comments
对象是一样的。
<?php $comments = Typecho_Widget::widget('Widget_Comments_List@page-comments', 'ignoreAuthor=true'); ?>
<?php while ($comments->next()) : ?>
<div class="comment-block">
<a href="<?php $comments->permalink(); ?>"><?php Comment::excerpt(20, "...", $comments) ?></a>
</div>
<?php endwhile; ?>
文章出自:虾米皮皮乐工作室 https://xiamp.net/archives/typecho-gets-a-list-of-all-comments-on-the-site-in-a-separate-page.html,版权所有。本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源。
评论列表(5条)
去问问企鹅村
我来学习一下,然后把它举一反三。
这正是我想要的
感谢分享

