Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > user-as-rss.php
<%
	Header( "Content-type: text/xml");
	include_once( "modules/utils.inc.php" );
	$site = getSiteUrl();
			
	echo '<' . '?xml version="1.0" encoding="iso-8859-1"?>';
	$dcdate = preg_replace( "/00$/", ":00", date("Y-m-d\TH:iO"));

	$hard_max = 64;
	$MAX_LINKS = ($num && $num < $hard_max) ? $num : 15;

	# global:
	$title = "Feed Me Links!";
	$creatorEmail = "all-of-hide@address.com";
	$description = "your portable public link suitcase";

	# user
	$title = $who ? "The Last $MAX_LINKS Links of $who!" : $title;
	$description = $who ? "from FeedMeLinks.com" : "your portable public link suitcase";
	$creatorEmail = getEmailAddressForUser( $who );
	if( $who && isValidUser( $who )) {

%>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:admin="http://webns.net/mvcb/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:content="http://purl.org/rss/1.0/modules/content/">

  <channel>
    <title><%= $title %></title>
		<link><%= $site %></link>
    <description><%= $description %></description>
		<dc:language>en-us</dc:language>
		<dc:creator><%= $creatorEmail %></dc:creator>
		<dc:rights>Copyleft 2004</dc:rights>
		<dc:date><%= $dcdate %></dc:date>
		<admin:errorReportsTo rdf:resource="mailto:hide@address.com"/>
<%
		$con_userAsRss = mysql_connect();
		mysql_selectdb( getDBName() );
		$qs = "SELECT * from links WHERE isPrivate IS NULL AND submitter='$who' ORDER BY createDate DESC";
		$q = mysql_query( $qs );
		$numRows = mysql_num_rows($q);
		if( $numRows ) {
			$i = 0;
			while( $i < $MAX_LINKS && $i < $numRows ) {
				$id   = mysql_result($q,$i,"ID");
				$dcDate = formatAsDCDate( mysql_result($q,$i,"createDate") );
				$uDate  = formatTS( mysql_result($q,$i,"createDate") );
				$name = makeSafeName( mysql_result($q,$i,"name"));
				$name = str_replace ( "&", "&amp;", $name);
				$url = makeSafeName( mysql_result($q,$i,"url"));
				$url = str_replace ( "&", "&amp;", $url);
				$url = str_replace ( " ", "%20", $url);

				$submitter = makeSafeName( mysql_result($q,$i,"submitter"));
				$infoURL = $site . "/u/" . $submitter;
%>
<item>
	<title><%= ($who ? "" :  $submitter . " : ") . $name %></title>
	<link><%= $site . "/" . ($short ? "t/$id" : $id ) %></link>
	<description><%= $who ? "added $uDate" : "link added by $submitter" %></description>
	<guid isPermaLink="true"><%= $site . "/" . ($short ? "t/$id" : $id ) %></guid>
	<content:encoded><![CDATA[
		<p>
			<a href="<%= $url %>"><%= $url %></a> - <%= $uDate %>
		</p>
		<p>
			&nbsp; link added by <a href="<%= $infoURL %>"><%= $submitter %></a><br />
			&nbsp; 
			<% 
				$cats = getCategoriesForLinkAsHTML( $id, "jm3", "add-trailing-noun=1", 0 ); 
				$cats = $cats ? "($cats)" : "(" . getUnCattedName() . ")";
			%>
			<%= $cats %>
		</p>
		<%= getCommentCSS() %>
		<%= getCommentsForLink( $id, "nobody", $debug ) %>
	]]></content:encoded>
	<dc:subject><%= $cats %></dc:subject>
	<dc:date><%= $dcDate %></dc:date>
</item>
<%
				$i++;
			}
			# getting errors here for some reason...
			#conClose( $con_UserAsRss );
		}
%>

  </channel>
</rss>
<% } else { %>

<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:admin="http://webns.net/mvcb/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:content="http://purl.org/rss/1.0/modules/content/">

  <channel>
    <title>Feed Me Links : ERROR - NO SUCH USER "<%= $who %>"</title>
		<link><%= $site %></link>
    <description><%= $description %></description>
		<dc:language>en-us</dc:language>
		<dc:creator>hide@address.com</dc:creator>
		<dc:rights>Copyleft 2004</dc:rights>
		<dc:date><%= $dcdate %></dc:date>
		<admin:errorReportsTo rdf:resource="mailto:hide@address.com"/>
		<item>
			<title>Feed Me Links</title>
			<link>http://feedmelinks.com/</link>
			<description>Feed Me Links</description>
			<guid isPermaLink="true">http://feedmelinks.com/</guid>
			<content:encoded>
			</content:encoded>
			<dc:subject>Feed Me Links</dc:subject>
			<dc:date>2004-05-03T14:40-04:00</dc:date>
		</item>
  </channel>
</rss>
<% } %>
Return current item: FeedMeLinks, Social BookmarkingSince2002