Search code examples
phpparsingrsssimplepie

Simplepie: Sort RSS posts by date last updated


I'm trying to sort the posts of an rss feed by the date they were last updated, using simplepie to parse the feed. I was thinking I could use the "get item tags method", like so:

$feed_object->get_item_tags("http://www.w3.org/2005/Atom", "updated");,

in order to create an array of update dates, and then sort them somehow. However, get_item_tags() throws the following:

Fatal error: Call to undefined method SimplePie::get_item_tags()

So: Is there an easier/better way to do this, and what is wrong with my usage of get_item_tags()?

Thanks.


Solution

  • perhaps this way?

    $item = $feed->get_item(0));   // the first item in feed; do it in loop
    $data = $item->get_item_tags("http://www.w3.org/2005/Atom", "updated");
    

    get_item_tags is an item level function.