IF statement to see if any ITEMS in feed

Discussion in 'XML & RSS' started by dermotwaters, Dec 15, 2007.

  1. #1
    Hi, I'm trying to write an IF statement to check if there are any ITEMS in the feed. If there aren't any items, I want to display a certain message. If there are items, I want to run through a FOREACH loop to display each item. But I keep getting errors. I'm using PHP4 and Magpie.

    Here's the latest variation on what I'm trying...

    if ($rss->items == 0) {
    [display msg bc there are no feed items]
    } else {
    foreach ($rss->items as $item) {
    [do something for each item]
    }
    }

    Any help would be greatly appreciated!
     
    dermotwaters, Dec 15, 2007 IP
  2. blacknet

    blacknet Active Member

    Messages:
    709
    Likes Received:
    16
    Best Answers:
    2
    Trophy Points:
    70
    #2
    use DomDocument (php) instead..
     
    blacknet, Dec 21, 2007 IP