首页 » 日记 » 正文内容
1年前 寻梦xunm 230 日记

最近用独立页面编写的一个朋友圈模板,基于评论功能实现。
为了实现显示父级评论下面有多少条子级评论,让页面看起更加舒适。
实现函数代码

function parent($coid) {
    $db = Typecho_Db::get();
    $parent = $db->select('table.comments.parent')->from('table.comments')->where('parent = ?', $coid);
$parent=$db->fetchAll($parent);
    return count($parent);
}

使用代码,一般添加到comments.php文件中(需要自定义评论才能使用)。

<?php echo parent($comments->coid);?>
0 赞 or 打赏
喜欢就打赏一点
微信 支付宝
已有0 条评论,0 个点赞
隐私

Q Q:1340326824

vipshiyi@qq.com

QQ群:422720328

生活所迫,再见了苦逼的BUG们,以后有缘在会吧。