Error 502
Advanced OT User
- Joined
- Sep 25, 2022
- Messages
- 305
- Solutions
- 12
- Reaction score
- 211
AAC - Create season rank based on highscores
Hi there! I had a little idea and wanted to know if someone can craft it. What I need to do, is to create a new table, for example, season1. This table will hold the current highscore value of the character, for example, if the character is currently rank#1, this will show inside his...
otland.net
Hello, I don't know much about the format .html.twig , I come to ask for help
I try to change .php to .html.twig
why not use .php?
because if i do it from php , it orders it above
www\system\pages\characters.php
LUA:
//Season Rankings
$main_content .= '<table border="0" cellpadding="4" cellspacing="1" width="100%">
<TR BGCOLOR="'.$config['site']['vdarkborder'].'"><TD COLSPAN=10 WIDTH=90% CLASS=white><B>Season Rankings:</td></tr>
<tbody>';
$seasons = $SQL->query("SELECT id, name FROM seasons ORDER BY id")->fetchAll();
foreach($seasons as $season) {
$seasonData = $SQL->query("SELECT rank_level, level, experience FROM season_archive WHERE `season_id` =" . (int)$season['id'] . " AND `player_id` =" . (int)$player->getId())->fetch();
$main_content .= '
<tr BGCOLOR="'.$config['site']['lightborder'].'">';
$main_content .= '<td>' . $season['name'] . '</td>';
if ($seasonData) {
$main_content .= '<td>#' . $seasonData['rank_level'] . ' (level ' . $seasonData['level'] . ', exp ' . $seasonData['experience'] . ')</td>';
} else {
// player has no rank for season = was created after season finished
$main_content .= '<td>Not participated in competition</td>';
}
$main_content .= '</tr>';
}
$main_content .= '</tbody></table></br>';
\www\system\templates\characters.html.twig
my failed try:
it only shows the header and not the query sql
Code:
{% set season_table = '' %}
{% set season_table %}
<table border="0" cellpadding="4" cellspacing="1" width="100%">
<tr bgcolor="{{ config.site.vdarkborder }}">
<td colspan="10" width="90%" class="white"><b>Season Rankings:</b></td>
</tr>
<tbody>
{% set seasons = SQL.query("SELECT id, name FROM seasons ORDER BY id").fetchAll() %}
{% for season in seasons %}
{% set seasonData = SQL.query("SELECT rank_level, level, experience FROM season_archive WHERE season_id =" ~ season.id ~ " AND player_id =" ~ player.getId()).fetch() %}
<tr bgcolor="{{ config.site.lightborder }}">
<td>{{ season.name }}</td>
{% if seasonData %}
<td>#{{ seasonData.rank_level }} (level {{ seasonData.level }}, exp {{ seasonData.experience }})</td>
{% else %}
<td>Not participated in competition</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table></br>
{% endset %}
{{ season_table|raw }}
Last edited: