Created 2 versions, with table design and without, just remove the one that does not fit your layout.
In index.php, before:
Add this code:
Download medals.zip and extract it to your Znote AAC folder to make images work.
Thanks to @gremlee for letting me borrow his database while creating this.
In index.php, before:
PHP:
$cache = new Cache('engine/cache/news');
Add this code:
PHP:
// Most powerful guilds for TFS 0.3/4 and 1.0
////////////////////////
// Create a cache file to avoid high SQL load
$cache = new Cache('engine/cache/guilds');
if ($cache->hasExpired()) {
// Fetch guild data
if ($config['TFSVersion'] == 'TFS_03') $guilds = mysql_select_multi('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `killers` k LEFT JOIN `player_killers` pk ON `k`.`id` = `pk`.`kill_id` LEFT JOIN `players` p ON `pk`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` gr ON `p`.`rank_id` = `gr`.`id` LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id` WHERE `k`.`unjustified` = 1 AND `k`.`final_hit` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 3;');
elseif ($config['TFSVersion'] == 'TFS_10') $guilds = mysql_select_multi('SELECT `g`.`id` AS `id`, `g`.`name` AS `name`, COUNT(`g`.`name`) as `frags` FROM `players` p LEFT JOIN `player_deaths` pd ON `pd`.`killed_by` = `p`.`name` LEFT JOIN `guild_membership` gm ON `p`.`id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id` WHERE `pd`.`unjustified` = 1 GROUP BY `name` ORDER BY `frags` DESC, `name` ASC LIMIT 0, 3;');
$cache->setContent($guilds);
$cache->save();
} else {
$guilds = $cache->load();
}
if (!empty($guilds) || !$guilds) {
$divsize = 400;
?>
<!-- No table design -->
<center><h1>Most powerful guilds</h1></center>
<div style="margin: auto; width: <?php echo $divsize; ?>px;">
<?php
$number = 1;
foreach ($guilds as $guild) {
?>
<div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
<a href="guilds.php?name=<?php echo $guild['name']; ?>"><img style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png" alt="<?php echo $number; ?>"><br>
<center><b><?php echo $guild['name']; ?></b><br>
Kills: <?php echo $guild['frags']; ?></center></a>
</div>
<?php
$number++;
}
?>
</div>
<!-- With table design -->
<table id="news">
<tr class="yellow">
<td class="zheadline"><center><b>Most powerful guilds</b></center></td>
</tr>
<tr>
<td>
<div style="margin: auto; width: <?php echo $divsize; ?>px;">
<?php
$number = 1;
foreach ($guilds as $guild) {
?>
<div style="float: left; width: <?php echo (int)$divsize / 3; ?>px;">
<a href="guilds.php?name=<?php echo $guild['name']; ?>"><img style="max-width: <?php echo (int)$divsize / 3; ?>px;" src="medals/<?php echo $number; ?>.png" alt="<?php echo $number; ?>"><br>
<center><b><?php echo $guild['name']; ?></b><br>
Kills: <?php echo $guild['frags']; ?></center></a>
</div>
<?php
$number++;
}
?>
</div>
</td>
</tr>
</table>
<?php
}
// End powerful guilds
Download medals.zip and extract it to your Znote AAC folder to make images work.
Thanks to @gremlee for letting me borrow his database while creating this.
Attachments
-
medals.zip50.6 KB · Views: 580 · VirusTotal
Last edited: