Location: PHPKode > projects > FeedMeLinks, Social BookmarkingSince2002 > modules/tag-cloud.inc.php
<%
	$u == $user ? $auth = 1 : $auth = 0;
	$u = $user ? $user : $u;
	$qs_max = "SELECT count(*) as num_links, ID as catID, name FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = '$u' GROUP BY name ORDER BY num_links DESC LIMIT 1;";
	
	$qs = "SELECT count(*) as num_links, ID as catID, name FROM linksGroups, linksCategoriesXRef WHERE linksGroups.ID = linksCategoriesXRef.catID AND linksGroups.userid = '$u' GROUP BY name ORDER BY name ASC;";

%>

<style type="text/css">
<%
	# graph params
	$max_font = 36;
	$min_font = 8;

	do {
%>
	.f<%= $min_font + 2 * $i %> { font-size: <%= $min_font + (2 * $i) %>pt; }
<%
} while( $i++ < $max_font / 2 );
%>
</style>

<div class="tagcloud">
<%
  $con = mysql_connect();
  mysql_selectdb( getDBName() );

  $q = mysql_query( $qs_max );
  if( !$q ) return;
	$numRows = mysql_num_rows($q);
	if( !$numRows ) {
%>
<div class="attention warning">
No such user or a user without tags.
</div>
<%
		return;
	}
	$max = mysql_result($q, 0, "num_links");
	
  $q = mysql_query( $qs );
  if( !$q ) return;
	$numRows = mysql_num_rows($q);

	$scale = ($max_font - $min_font) / $max;

  for( $i = 0; $i < $numRows; $i++ ) {
    $name = makePrettyFolderName( urldecode( mysql_result($q, $i, "name")));
		if( $auth || isPublic( mysql_result($q, $i, "name"))) {
			$id = mysql_result($q, $i, "catID");
			$size = floor( $min_font + ($scale * mysql_result($q, $i, "num_links")));

			# round off to only show even number increments
			$size = ($size % 2 == 0 ) ? $size : $size + 1;
			if( $size > $min_font ) {
%>
<a rel="tag" class="f<%= $size %>" href="/f/<%= $id %>"><nobr><%= $name %></nobr></a>
<%
		}
		}
	}
%>
</div>
Return current item: FeedMeLinks, Social BookmarkingSince2002