Created
June 3, 2011 08:18
-
-
Save hulbert/1006046 to your computer and use it in GitHub Desktop.
Super Simple Instapaper Likes List with Simplepie
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 | |
@include 'php/simplepie/simplepie.inc'; | |
$instapaper_url = "YOUR INSTAPAPER RSS FEED HERE"; | |
$feed = new SimplePie(); | |
$feed->set_feed_url($instapaper_url); | |
// $feed->enable_cache(false); // for use before setting up caching | |
$feed->set_cache_location($_SERVER['DOCUMENT_ROOT'] . '/php/simplepie/cache'); | |
$feed->set_cache_duration(60*15); | |
$feed->handle_content_type(); /* important, sets to UTF-8 */ | |
$feed->init(); | |
if ($feed->get_item_quantity() > 0): | |
echo '<ul>'; | |
foreach ($feed->get_items(0,5) as $like): ?> | |
<li> | |
<a href="<?=$like->get_permalink()?>" target="_blank"> | |
<? if (strlen($like->get_title()) > 55) { | |
echo substr($like->get_title(),0,55), '…'; | |
} else echo $like->get_title(); ?> | |
</a> | |
</li> | |
<? endforeach; | |
endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment