diff options
author | cash <cash.costello@gmail.com> | 2009-01-18 23:24:53 +0000 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2009-01-18 23:24:53 +0000 |
commit | fdb9fabe369e5cd1139d0318fe7ccbbaba3ee04b (patch) | |
tree | 531c03ad97e2fff2b034570b8bcfd96b70073fa3 | |
parent | 28d72f61e8b2078f8fb299341f808bd3fc47bcc7 (diff) | |
download | elgg-fdb9fabe369e5cd1139d0318fe7ccbbaba3ee04b.tar.gz elgg-fdb9fabe369e5cd1139d0318fe7ccbbaba3ee04b.tar.bz2 |
added check for no feed found
-rw-r--r-- | views/default/widgets/feed_reader/view.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/views/default/widgets/feed_reader/view.php b/views/default/widgets/feed_reader/view.php index 4f51fb77c..e1b817116 100644 --- a/views/default/widgets/feed_reader/view.php +++ b/views/default/widgets/feed_reader/view.php @@ -14,14 +14,18 @@ $post_date = $vars['entity']->post_date; $feed = new SimplePie($feed_url); + + $num_posts_in_feed = $feed->get_item_quantity(); + if (!$num_posts_in_feed) + echo 'Cannot find feed. Check the feed url.'; ?> <div class="simplepie_blog_title"> <h2><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h2> </div> <?php - if ($num_items > $feed->get_item_quantity()) - $num_items = $feed->get_item_quantity(); + if ($num_items > $num_posts_in_feed) + $num_items = $num_posts_in_feed; foreach ($feed->get_items(0,$num_items) as $item): ?> |