blob: b640890d2b08d56c55256217d766de4d5e1beb0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
global $CONFIG;
if (!class_exists('SimplePie'))
{
require_once $CONFIG->pluginspath . '/simplepie/simplepie.inc';
}
$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>';
}
?>
|