• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

AAC [Myacc] season rank based on highscores .html.twig

Error 502

Advanced OT User
Joined
Sep 25, 2022
Messages
259
Solutions
9
Reaction score
162
Location
Chile

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:

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 }}
my dear, can you put this characters.php with reset/reborn? i want to put mine please help me
 
Back
Top