Search code examples
phprsssimplepie

Simplepie and slash:comments


I use SimplePie to display an RSS Feed on my Page. Now I want to show the number of comments.

The RSS:

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

How can I show this with Simplepie?


Solution

  • You want to use $item->get_item_tags() to do this. At a guess, you want the http://purl.org/rss/1.0/modules/slash/ namespace, with the comments tag.

    $comments = $item->get_item_tags('http://purl.org/rss/1.0/modules/slash/', 'comments');
    

    You can then take a look at this data structure to work out what you need. At a guess...

    $number = $comments[0]['data'];