item_ids

(ReachRSS >= 0.91)
item_ids -- Returns an array of valid item ids for the specified channel

Description

array item_ids ( string channel_url [ , boolean sorted ] )

All items in ReachRSS are accessed via the channel URL that they appear in, and an internally generated item id. Before accessing item properties via item_property() you need to know one or more of these item ids. item_ids() returns you an array of all the item ids in the specified channel.

If you set the second parameter (sorted) to true, the items returned will be sorted first in descending order before being returned. If you do not specify this there's no guarantee the items will be returned in any specific order.

The returned array is a list of string values, each one is a valid item id for that channel. If the channel you specified has not been subscribed to, item_ids() will return false.

Example 1. item_ids() example

$ReachRSS = new ReachRSS();
$ReachRSS->Startup();
$ReachRSS->add_channel("http://www.comicalert.com/public/popular24.xml");
$ItemIDs = $ReachRSS->item_ids(
                     "http://www.comicalert.com/public/popular24.xml",
                     true
                   );
foreach ($ItemIDs as $ItemID) {
  print "$ItemID\n";
}

This example will subscribe ReachRSS to the "most popular comics" feed at Comic Alert!, and then uses item_ids() to get a sorted list of all item ids and prints them.

See also item_property(), item_exists()

Back to Function List

 

Home | Features | Samples | Demo | Download | Register | Help / Support