Created
January 2, 2012 21:03
-
-
Save matiskay/1552110 to your computer and use it in GitHub Desktop.
Simple Pie Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once('includes/vendor/simplepie/simplepie.inc'); | |
$feed = new SimplePie(); | |
$feed->set_feed_url( 'your.xml' ); | |
//$feed->set_cache_location( $_SERVER['DOCUMENT_ROOT'] . '/includes/vendor/simplepie/cache' ); | |
//@TODO: I use my root because I'm using a simbolic link. I have to really understand whot virtualhost works. | |
$feed->set_cache_location( 'Set your location' ); | |
$feed->init(); | |
$feed->handle_content_type(); | |
?> | |
foreach ($feed->get_items() as $item): | |
?> | |
<li> | |
<a href="<?php echo $item->get_permalink(); ?>"<?php echo $item->get_date('g:i'); ?></a> | |
<h2 class="text"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2> | |
</li> | |
endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment