Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Limit number of items in Simple pie (http://www.go4expert.com/forums/limit-items-simple-pie-t21366/)

suhas93 15Mar2010 17:24

Limit number of items in Simple pie
 
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

suhas93 15Mar2010 17:38

Re: Limit number of items in Simple pie
 
Sorry for the inconvenience ..

Problem sorted

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

to show 5 titles..

Sorry


All times are GMT +5.5. The time now is 13:43.