mirror of
https://github.com/slawkens/myaac.git
synced 2026-04-25 11:53:31 +02:00
tibiacom: Reduce queries count from highscores box
This commit is contained in:
@@ -1,15 +1,13 @@
|
||||
<?php
|
||||
|
||||
$topPlayers = getTopPlayers(5);
|
||||
foreach($topPlayers as &$player) {
|
||||
$outfit_url = '';
|
||||
if (setting('core.online_outfit')) {
|
||||
$outfit_url = setting('core.outfit_images_url') . '?id=' . $player['looktype'] . (!empty
|
||||
($player['lookaddons']) ? '&addons=' . $player['lookaddons'] : '') . '&head=' . $player['lookhead'] . '&body=' . $player['lookbody'] . '&legs=' . $player['looklegs'] . '&feet=' . $player['lookfeet'];
|
||||
|
||||
$player['outfit'] = $outfit_url;
|
||||
$topPlayers = Cache::remember('tibiacom_highscores_top_players', 10 * 60, function() {
|
||||
$topPlayers = getTopPlayers(5);
|
||||
foreach($topPlayers as &$player) {
|
||||
$player['outfit'] = $player['outfit_url'];
|
||||
$player['link'] = getPlayerLink($player['id'], false);
|
||||
}
|
||||
}
|
||||
|
||||
return $topPlayers;
|
||||
});
|
||||
|
||||
$twig->display('highscores.html.twig', array(
|
||||
'topPlayers' => $topPlayers
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<div id="Topbar" class="Themebox" style="background-image:url({{ template_path }}/images/themeboxes/highscores/highscores.png);">
|
||||
<div class="top_level" style="background:url({{ template_path }}/images/themeboxes/bg_top.png)" align=" ">
|
||||
{% for player in topPlayers %}
|
||||
<div style="text-align:left"><a href="{{ getPlayerLink(player['name'], false) }} " class="topfont {% if player['online'] %}online{% else %}offline{% endif %}">
|
||||
<div style="text-align:left"><a href="{{ player['link'] }} " class="topfont {% if player['online'] %}online{% else %}offline{% endif %}">
|
||||
{% if setting('core.online_outfit') %}
|
||||
<img style="position:absolute;margin-top:-45px;margin-left:-25px;" src="{{ player.outfit }}" alt="player outfit"/>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user