aboutsummaryrefslogtreecommitdiff
path: root/views/default/widgets/feed_reader/view.php
blob: 6635ecf88baa1d18fdff2835963d5bb5a2d85819 (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
<?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>';      
  }
?>