aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/feed_reader
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2009-01-18 19:50:11 +0000
committercash <cash.costello@gmail.com>2009-01-18 19:50:11 +0000
commitf343959dc964caa05d4763aabe230bb790f62757 (patch)
tree7d4994ce1ff0127749a151f5b620c619918260e8 /views/default/widgets/feed_reader
downloadelgg-f343959dc964caa05d4763aabe230bb790f62757.tar.gz
elgg-f343959dc964caa05d4763aabe230bb790f62757.tar.bz2
Diffstat (limited to 'views/default/widgets/feed_reader')
-rw-r--r--views/default/widgets/feed_reader/edit.php4
-rw-r--r--views/default/widgets/feed_reader/view.php31
2 files changed, 35 insertions, 0 deletions
diff --git a/views/default/widgets/feed_reader/edit.php b/views/default/widgets/feed_reader/edit.php
new file mode 100644
index 000000000..3b14dcc97
--- /dev/null
+++ b/views/default/widgets/feed_reader/edit.php
@@ -0,0 +1,4 @@
+ <p>
+ <?php echo elgg_echo("simplepie:feed_url"); ?>
+ <input type="text" name="params[feed_url]" value="<?php echo htmlentities($vars['entity']->feed_url); ?>" />
+ </p>
diff --git a/views/default/widgets/feed_reader/view.php b/views/default/widgets/feed_reader/view.php
new file mode 100644
index 000000000..6635ecf88
--- /dev/null
+++ b/views/default/widgets/feed_reader/view.php
@@ -0,0 +1,31 @@
+<?php
+
+ $feed_url = $vars['entity']->feed_url;
+ if($feed_url){
+
+ $feed = new SimplePie($feed_url);
+ $feed->handle_content_type();
+
+
+?>
+<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>
+ </div>
+
+ <?php endforeach; ?>
+<?php
+ } else {
+
+ echo '<p>' . elgg_echo('simplepie:notset') . '</p>';
+ }
+?>