【问题标题】:Simplepie and slash:comments简单和斜线:评论
【发布时间】:2011-03-17 16:07:44
【问题描述】:

我使用 SimplePie 在我的页面上显示 RSS 提要。 现在我想显示 cmets 的数量。

RSS:

<slash:comments>0</slash:comments>

我怎样才能用 Simplepie 显示这个?

【问题讨论】:

  • 是来自单一提要的提要吗? cmets 是在您的页面上还是在提要中?
  • 评论在页面上。但在提要中,我有 COUNT 标签。
  • 目前看来 SimplePie 不支持 cmets 标签。您可以通过向类添加另外 2 个函数来添加支持,例如 get_comment() 和 get_comment_tags()

标签: php rss simplepie


【解决方案1】:

您想使用$item-&gt;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'];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-14
    • 1970-01-01
    • 2014-03-15
    相关资源
    最近更新 更多