simplepie - Descending sorting order not working -
i have created crone job retrieve list of feeds once display them not in chronological order: http://softwaretestingblogs.thetestingmap.org/sp/index.php have put in get_date() , get_local_date(). can see 5th of april displayed before 9th of april.
any hints doing wrong?
this crone job:
<?php require_once ('simplepie_1.3.1.compiled.php'); $urls = array( 'http://blog.99tests.com/feed/', 'http://feeds.feedburner.com/ministryoftesting?format=xml', 'http://www.satisfice.com/blog/feed', 'http://agiletesting.blogspot.com/feeds/posts/default', /.......................... ); $cache_location = './cache'; $feed = new simplepie(); $feed->set_feed_url($urls); $feed->set_item_limit(1); $feed->set_cache_location($cache_location); $feed->enable_order_by_date(true); $feed->handle_content_type(true); $feed->strip_htmltags(array_merge($feed->strip_htmltags, array('h1', 'a', 'img','b','i'))); $feed->set_cache_duration(0); $feed->set_timeout(30); $feed->init(); ?>
this display code:
<?php require_once ('simplepie_1.3.1.compiled.php'); $feed = new simplepie(); $feed->set_feed_url(array( 'http://blog.99tests.com/feed/', 'http://feeds.feedburner.com/ministryoftesting?format=xml', )); // settings crone job $feed->set_cache_duration(999999999); $feed->set_timeout(-1); $feed->enable_order_by_date(); $feed->strip_htmltags(array_merge($feed->strip_htmltags, array('h1', 'a', 'img','b','i'))); $feed->set_item_limit(1); $feed->handle_content_type(); $feed->init(); ?> <html> <head> </head> <body> <?php if ($feed->error): ?> <p><?php echo $feed->error;?></p> <?php endif;?> <h1> display content</h1> <?php foreach($feed->get_items() $item) { ?> <table border="1" style="width:1000px"> <tr> <td width="15%"> <p><small><?php echo $item->get_date('j m y | g:i t'); ?></small></p> </td> <td width="15%"> <p><small><?php echo $item->get_local_date('%a %e %b %y'); ?></small></p> </td> <td width="15%"> <small> <?php echo $item->get_feed()->get_title();?> </small> </td> <td width="15%"> <small class="title"><a href="<?php echo $item->get_link(0); ?>" target="_blank"><?php echo $item->get_title(); ?></a></small> </td> <td width="40%"> <?php echo substr($item->get_description(),0,350); ?> </td> </tr> </table> <?php } ?> </body> </html
Comments
Post a Comment