Seite 1 von 1
Spiele-Übersicht: zusätzliche Spalte für Mon-Hiscore
Verfasst: 24.07.2004 16:03
von Gumfuzi
Hallo Leute!
Ich möchte gerne beim Activity Mod (bei der Spiele-Übersicht) vor der Spalte mit dem alltime-Hiscores noch eine Spalte mit jeweils dem aktuellen Hiscore des laufenden Monats haben.
Ich habe den Monatshiscore-Mod auch drauf (d.h. die Mon-Hiscorestabellen sind in der DB vorhanden und funzen auch), aber dort sieht man ja nur unten per Extraseite die Monatshiscores auf einen "Haufen"
Ich möchte eben aufgrund der Übersichtlichkeit und zum Ansporn die Mon.Hiscores auch noch bei der Spieleübersicht links neben den normalen "alltime"-Hiscores stehen haben.
Meine Versuche, daß selbst zu modden scheiterten kläglich, dafür kenne ich mich noch etwas zu wenig mit PHP bzw. mySQL aus...
Wer kann mir da einen Tipp geben? Hat das schon jemand so gemacht?
Bin für jede Hilfe dankbar!!
Gumfuzi
Verfasst: 24.07.2004 18:56
von Helmut71
activity.php
---[find]----
if ($best_player != '-:-')
---[add, before]----
// Check for Highscore - only this month's scores!
$month = date(n);
$year = date(Y);
$time_first = mktime(0,0,0,$month,1,$year);
$last_day = date ("t",$time_first);
$time_last = mktime(23,59,59,$month,$last_day,$year);
$sql = "SELECT * FROM " . iNA_SCORES . "
WHERE game_name = '" . $game_name . "'
AND date >= " . $time_first . "
AND date <= " . $time_last . "
ORDER BY score " . $list_sort . ", date DESC";
if(!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't obtain Scores data", "", __LINE__, __FILE__, $sql);
}
$score_info_month = $db->sql_fetchrow($result);
$best_score_month = $score_info_month['score'];
$best_player_month = $score_info_month['player'];
---------
----[find]----
if ($best_player != '-:-')
----[replace with]----
if ($best_player != '-:-' && $best_player_month != '-:-')
----------
----[find]----
if ($row['username'] == $best_player)
{
$game_user_id = $row['user_id'];
}
----[add, after]----
if ($row['username'] == $best_player_month) {
$game_user_id_month = $row['user_id'];
}
-------------
----[find]----
if ($game_user_id <> '')
{
$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$game_user_id");
$profile = '<a href="' . $temp_url . '"><span class="gentbl">' . $best_player . '</span></a>';
$best_player = $profile;
}
----[add, after]----
if ($game_user_id_month <> '')
{
$temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$game_user_id_month");
$profile_month = '<a href="' . $temp_url . '"><span class="gentbl">' . $best_player_month . '</span></a>';
$best_player_month = $profile_month;
}
------------
----[find]----
$topten = '';
$best_score = '';
$best_player = '';
$dash = '';
----[add, after]----
$best_score_month = '';
$best_player_month = '';
-------------------
---[find]----
"BEST_SCORE" => $best_score,
"BEST_PLAYER" => $best_player,
----[add, after]----
"BEST_SCORE_MONTH" => $best_score_month,
"BEST_PLAYER_MONTH" => $best_player_month,
---------------------
activity.tpl:
----[FIND]-----------------
<th class="thCornerR" nowrap="nowrap">Best Player</th>
----[ADD, BEFORE]---------
<th class="thTop" nowrap="nowrap">Best Player<br />this month</th>
-------------------------------
----[FIND]-----------------
<td class="{game.ROW_CLASS}" align="right" nowrap="nowrap"><span class="gen">{game.BEST_PLAYER} {game.DASH} {game.BEST_SCORE}</span></td>
----[ADD, BEFORE]--------------
<td class="{game.ROW_CLASS}" align="right" nowrap="nowrap"><span class="gen">{game.BEST_PLAYER_MONTH} {game.DASH} {game.BEST_SCORE_MONTH}</span></td>
--------------------------
unten dann colspan +1 setzen... also wenn da ne 6 steht auf 7 setzen...
activity.php:
----[FIND]---------
$time_first = mktime(0,0,0,$month,1,$year);
$last_day = date ("t",$time_first);
$time_last = mktime(23,59,59,$month,$last_day,$year);
$sql = "SELECT * FROM " . iNA_SCORES . "
WHERE game_name = '" . $game_name . "'
AND date >= " . $time_first . "
AND date <= " . $time_last . "
ORDER BY score DESC, date DESC";
------------------
---[REPLACE WITH]-----------------
$sql = "SELECT highscore_score, highscore_player FROM " . iNA_HIGHSCORES . "
WHERE highscore_year = '". $year ."'
AND highscore_mon = '". $month ."'
AND highscore_game = '" . $game_name . "'
ORDER BY highscore_score $list_type
LIMIT 1";
------------------------------
---[FIND]--------------
$best_score_month = $score_info_month['score'];
$best_player_month = $score_info_month['player'];
----[REPLACE WITH]--------------
$best_score_month = $score_info_month['highscore_score'];
$best_player_month = $score_info_month['highscore_player'];
-----------------------------------
Verfasst: 24.07.2004 21:58
von Gumfuzi
Danke!
...aber warum 2x die activity.php ändern? ist das richtig?
... und es gibt 3 activity-Templates : body, scores, stats...
Verfasst: 24.07.2004 22:28
von Gumfuzi
Habe es gefunden! Funzt super!!! Danke!!!!!!!!!!
P.S.: es war die activity_body.tpl