1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Limit number of items in Simple pie

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

  1. suhas93

    suhas93 New Member

    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

    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