0
我使用SimplePie在我的页面上显示RSS源。 现在我想显示评论的数量。Simplepie和斜杠:评论
的RSS:
<slash:comments>0</slash:comments>
我怎样才能显示这个用了SimplePie?
我使用SimplePie在我的页面上显示RSS源。 现在我想显示评论的数量。Simplepie和斜杠:评论
的RSS:
<slash:comments>0</slash:comments>
我怎样才能显示这个用了SimplePie?
你想用$item->get_item_tags()
来做到这一点。猜测,你需要http://purl.org/rss/1.0/modules/slash/
命名空间,comments
标签。
$comments = $item->get_item_tags('http://purl.org/rss/1.0/modules/slash/', 'comments');
然后,你可以看看这个数据结构来找出你需要的东西。猜...
$number = $comments[0]['data'];
这个工作对我来说:$ number = $ comments [0] ['data']; – 2011-03-23 07:52:06
是来自单一饲料的饲料吗?是您的网页上还是Feed中的评论? – 2011-03-17 16:21:04
评论在页面上。但在Feed中,我有 COUNT slash:comment>标记。 –
2011-03-17 16:25:30
它目前看起来不像SimplePie支持评论标签。你可以通过添加2个更多的函数来增加支持,比如get_comment()和get_comment_tags() – 2011-03-17 16:42:46