Wiki source for Mod024fHighScores

Show raw source

==== Wikka Mod 024 ====
Type: Feature Addition
**[[ | ChrisTessmer]]**
[[ | HighScores @ WakkaWiki]]

HighScores is a fun little action that compares all the RegisteredUsers on your WakkaWiki insofar as how many OwnedPages each one has. Adding this script to your site will probably incite a flurry of create-pages-just-to-up-one's-ranking behavior, but other than that it's pretty harmless. Some users //really// enjoy this thing.

You can see this [[ | WakkaAction]] in action at [[ |]] //(archived)//
~&This wiki is no longer publicly accessible; the only access I could get was at the root:; link changed to archived version --JavaWoman

A few things:
1) If you have a large number of RegisteredUsers, this ranking will end up being long (duh), so plan accordingly when you decide where to put it (like at the end of a page or give it it's own page or something).
2) The table formatting I used is pretty wretched //( 's .. yuck!)//; I just wanted results, //fast//. If anyone wants to make it cleaner or prettier (like using the CSS of the site to generate attractive alternating colored rows or something), by all means... GoForIt.

== Here's how to install it: ==

Create ''actions/highscores.php'':

# highscores.php {{HighScores}}
# by Chris Tessmer
# 19 Dec 2002
# license: GPL

$str = 'SELECT Count(*) AS cnt, `name` FROM ';
$str .= $this->config["table_prefix"] . 'users, ' ;
$str .= $this->config["table_prefix"].'pages ';
$str .= "WHERE `name` = `owner` AND `latest` = 'Y' AND `comment_on` = '' GROUP BY name ORDER BY cnt DESC;";
$rankQuery = $this->Query( $str );

$str = 'SELECT COUNT(*) FROM '.$this->config["table_prefix"].'pages WHERE `latest` = \'Y\' AND `comment_on` = \'\' ';
$totalQuery = $this->Query( $str );
$total = mysql_result($totalQuery, 0);

print( "<blockquote><table>" );

$i = 0;
while( $row = mysql_fetch_array($rankQuery) )
$str = '<tr>';
$str .= "<td>$i.  </td>";
$str .= '<td>'. $this->Format( $row["name"] ) .'</td>';
$str .= '<td> </td>';
$str .= '<td>    </td>';
$str .= '<td>'.$row["cnt"].'</td>';
$str .= '<td>    </td>';
$str .= '<td>'. round( ($row["cnt"]/$total)*100, 2).'% </td>';
$str .= '</tr>';
print( $str );
print( "</table></blockquote>" );

To use it, insert the text ##""{{HighScores}}""## into any page that you want the list to show up in.

-- [[ | ChrisTessmer]]


Ranking by bytes: change count(*) by sum(length(body)) in SQL queries..
-- VictorManuelVarela (2003-03-13 23:47:36)
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki