aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/feed_reader/view.php
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2009-01-18 22:32:30 +0000
committercash <cash.costello@gmail.com>2009-01-18 22:32:30 +0000
commit33c172943ddd2431773bbdb3c4cd23fce295f8d5 (patch)
treef0ce399af3d9da04d4d905db7b76a90fa598d5ec /views/default/widgets/feed_reader/view.php
parent0ffdb7c5fe3ccea8c5067d22a57da3214cd0fccb (diff)
downloadelgg-33c172943ddd2431773bbdb3c4cd23fce295f8d5.tar.gz
elgg-33c172943ddd2431773bbdb3c4cd23fce295f8d5.tar.bz2
added settings on num of entries to include and whether to include the post date
Diffstat (limited to 'views/default/widgets/feed_reader/view.php')
-rw-r--r--views/default/widgets/feed_reader/view.php41
1 files changed, 28 insertions, 13 deletions
diff --git a/views/default/widgets/feed_reader/view.php b/views/default/widgets/feed_reader/view.php
index b640890d2..300c56ec7 100644
--- a/views/default/widgets/feed_reader/view.php
+++ b/views/default/widgets/feed_reader/view.php
@@ -9,29 +9,44 @@
$feed_url = $vars['entity']->feed_url;
if($feed_url){
- $feed = new SimplePie($feed_url);
+ $excerpt = $vars['entity']->excerpt;
+ $num_items = $vars['entity']->num_items;
+ $post_date = $vars['entity']->post_date;
+
+ echo $feed_url;
+ $feed = new SimplePie();
+ $feed->set_feed_url($feed_url);
+ //$feed->set_autodiscovery_level(SIMPLEPIE_LOCATOR_ALL);
+ $feed->init();
$feed->handle_content_type();
-
-
+echo $post_date;
+ echo $feed->get_item_quantity();
+?>
+<h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1><br />
+<?php
+ if ($num_items > $feed->get_item_quantity())
+ $num_items = $feed->get_item_quantity();
+
+ foreach ($feed->get_items(0,$num_items) as $item):
?>
-<h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
- <?php
- /*
- Here, we'll loop through all of the items in the feed, and $item represents the current item in the loop.
- */
- foreach ($feed->get_items() as $item):
- ?>
<div class="item">
- <h2><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
- <p><?php echo $item->get_description(); ?></p>
- <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
+ <p><h3><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h3></p>
+ <?php if ($excerpt) echo '<p>' . $item->get_description(true) . '</p>'; ?>
+ <?php if ($post_date)
+ {
+ ?>
+ <p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
+ <?php } ?>
</div>
<?php endforeach; ?>
+
<?php
} else {
echo '<p>' . elgg_echo('simplepie:notset') . '</p>';
}
?>
+
+<!-- <p><?php //echo $item->get_description(); ?></p> -->