1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Limit number of items in Simple pie

Discussion in 'PHP' started by suhas93, Mar 15, 2010.

  1. suhas93

    suhas93 New Member

    Joined:
    Mar 7, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I'm using the Simple Pie library (simplepie.org) to pull out titles of a particular feed.
    When I use this script it shows me 25 titles.

    How can I change the number of titles shown?

    Code:
    <?php
    require_once('simplepie.inc');
    
    $feed = new SimplePie('digg.com');
    $feed->handle_content_type();
    
    foreach ($feed->get_items() as $item)
    {
           		 echo $item->get_title();	
                             echo '<br />'			 		 
    }
    
    ?>
    Thanks,
    Suhas
     
  2. suhas93

    suhas93 New Member

    Joined:
    Mar 7, 2010
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Sorry for the inconvenience ..

    Problem sorted

    I just had to use
    foreach ($feed->get_items(0,5)

    to show 5 titles..

    Sorry
     

Share This Page