Dynamic Stats Button

Morus

www.votezone.eu , www.privateserversranking.com
I changed a Dynamic Stats Button a little bit. See below all the steps to make it the same. I uploaded zipped .psd file so everyone that has photoshop can change it to your own needs :) .This is made for my own listing for Lineage 2. But can be easly adjusted.

screenshot of new ranking.png file first. You can find it in images/

Its the default image. But stats are showned individual for every single user. (see attached dynamic button.png image below).
dynamic button.png

Next step is to adjust settings_buttons.php and last part of the code, but I will paste whole code.

Code:
<?php
if (!defined('VISIOLIST')) {
  die("This file cannot be accessed directly.");
}
 
$TMPL = $DB->fetch("SELECT *
                  FROM {$CONF['sql_prefix']}_sites sites, {$CONF['sql_prefix']}_stats stats
                  WHERE sites.username = stats.username AND sites.username = '{$username}'", __FILE__, __LINE__);
if ($rank) {
  $TMPL['rank'] = $rank;
}
else {
  $TMPL['rank'] = $TMPL['old_rank'];
}
 
$TMPL['average_rating'] = $TMPL['num_ratings'] > 0 ? round($TMPL['total_rating'] / $TMPL['num_ratings'], 0) : 0;
 
$ranking_periods = array('daily', 'weekly', 'monthly');
$ranking_methods = array('unq_pv', 'tot_pv', 'unq_in', 'tot_in', 'unq_out', 'tot_out');
foreach ($ranking_periods as $ranking_period) {
  foreach ($ranking_methods as $ranking_method) {
    $TMPL["{$ranking_method}_avg_{$ranking_period}"] = 0;
    for ($i = 0; $i < 10; $i++) {
      $TMPL["{$ranking_method}_avg_{$ranking_period}"] = $TMPL["{$ranking_method}_avg_{$ranking_period}"] + $TMPL["{$ranking_method}_{$i}_{$ranking_period}"];
    }
    $TMPL["{$ranking_method}_avg_{$ranking_period}"] = $TMPL["{$ranking_method}_avg_{$ranking_period}"] / 10;
  }
}
 
$TMPL['average_rating'] = $TMPL['num_ratings'] > 0 ? round($TMPL['total_rating'] / $TMPL['num_ratings'], 0) : 0;
 
$img = imagecreatefrompng("{$CONF['path']}/images/ranking.png");
$color1 = imagecolorallocate($img, 0, 0, 0);
$color2 = imagecolorallocate($img, 0, 0, 0);
$color3 = imagecolorallocate($img, 255, 0, 0);
header ("Content-type: image/png");
 
imagestring($img, 10, 10, 5, $TMPL['username'], $color3);
imagestring($img, 3, 35, 20, $TMPL['xp_rate'], $color1);
imagestring($img, 3, 35, 30, $TMPL['sp_rate'], $color1);
imagestring($img, 3, 150, 20, $TMPL['drop_rate'], $color1);
imagestring($img, 3, 155, 30, $TMPL['adena_rate'], $color1);
imagestring($img, 3, 305, 20, $TMPL['safe_enchant'], $color1);
imagestring($img, 3, 305, 30, $TMPL['max_enchant'], $color1);
imagestring($img, 3, 55, 46, $TMPL['game_type'], $color3);
imagestring($img, 3, 175, 46, $TMPL['unq_in_0_monthly'], $color3);
//imagestring($img, 2, 80, 75, $TMPL['tot_pv_0_monthly'], $color1);
//imagestring($img, 2, 80, 90, $TMPL['unq_in_0_monthly'], $color1);
//imagestring($img, 2, 80, 84, "{$TMPL['average_rating']}/5", $color1);
 
imagestring($img, 3, 305 - ((strlen($TMPL['rank']) - 1) * 4), 46, $TMPL['rank'], $color3);
imagepng($img);
?>
Last thing you need to do is to change .css in your skins/yourskin/admin/default.css in my case.

find .preview-box and change the width from 200 to 472 px
Code:
    width: 472px; float:right;
 

Attachments

Mark

Administrator
Staff member
nice one :) there is a lot of potential with these buttons for sure! You can upload the PSD file, but zip it first ;)
 
Top