We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 56fda41b authored by tonyb486's avatar tonyb486

Much cooler tag cloud

parent e42bf3d2
......@@ -98,10 +98,10 @@ class User {
global $mdb2;
$res = $mdb2->query(" SELECT artist, count(artist) AS count FROM Scrobbles WHERE "
. 'username = ' . $mdb2->quote($this->name, 'text')
. " GROUP BY artist ORDER BY count DESC LIMIT 10");
. " GROUP BY artist ORDER BY count DESC LIMIT 40");
$data= $res->fetchAll(MDB2_FETCHMODE_ASSOC);
foreach($data as &$i) {
$i['percent'] = 6-(int)(($i['count']/$data[0]['count'])*5);
foreach($data as $count => &$i) {
$i['percent'] = (int) ($count/(count($data)/5)+1);
}
sort($data);
return $data;
......
......@@ -52,7 +52,7 @@
<h3>User's favorite artists</h3>
<ul class="tagcloud">
{section name=i loop=$tagcloud}
<li class="tc t{$tagcloud[i].percent}"><a href="#">{$tagcloud[i].artist}</a></li>
<li class="tc t{$tagcloud[i].percent}"><a href="#">{$tagcloud[i].artist|stripslashes}</a></li>
{/section}
</ul>
{include file='footer.tpl'}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment