SimplePie 1.5 is now available!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » API Reference » SimplePie » get_permalink()

get_permalink()

Description

class SimplePie {
	get_permalink ()
}

Returns the first link available with a relationship of “alternate”. Identical to passing 0 to get_link().

Availability

  • Available since SimplePie 1.0.
  • Previously existed as get_feed_link() since SimplePie Preview Release.
  • Previously existed as get_feed_permalink() since SimplePie 0.8.

Examples

Loop through each item and do something with each

<?php
require_once('../simplepie.inc');
 
$feed = new SimplePie('http://simplepie.org/blog/feed/');
$feed->handle_content_type();
 
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>Sample SimplePie Page</title>
 </head>
<body>
 
	<div class="header">
		<h1><a href="<?php echo $feed->get_permalink(); ?>"><?php echo $feed->get_title(); ?></a></h1>
		<p><?php echo $feed->get_description(); ?></p>
	</div>
 
	<?php foreach ($feed->get_items() as $item): ?>
 
		<div class="item">
			<h2 class="title"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
			<?php echo $item->get_description(); ?>
			<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
		</div>
 
	<?php endforeach; ?>
 
</body>
</html>

See Also


reference/simplepie/get_permalink.txt · Last modified: 2011/03/06 03:56 (external edit)