OSDN Git Service

[modify]死因ランキングテーブルにCSS適用
authorHabu <habu@users.sourceforge.jp>
Thu, 29 Mar 2018 11:35:57 +0000 (20:35 +0900)
committerHabu <habu@users.sourceforge.jp>
Thu, 29 Mar 2018 12:08:34 +0000 (21:08 +0900)
score/killer_ranking.php

index ae0d66c..5d2674d 100644 (file)
@@ -7,6 +7,7 @@ ini_set('error_log', 'errors/'.pathinfo(__FILE__, PATHINFO_FILENAME).'.log');
 ini_set('zlib.output_compression', 'On');
 
 require_once "db_common.inc";
+require_once "web_template.inc";
 
 $db = new ScoreDB();
 
@@ -15,31 +16,40 @@ $time_start = microtime(true);
 $killers = $db->get_killers_table();
 
 $query_time = microtime(true) - $time_start;
-?>
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
-<title>変愚蛮怒 死因ランキング</title>
-</head>
-
-<body>
-<h1>変愚蛮怒 死因ランキング</h1>
-<small>クエリ時間<?php echo sprintf("%.3f msec", $query_time * 1000) ?></small>
-<hr>
-<table>
-<tr><th>回数(内、彫像・麻痺状態)</th><th>死因</th></tr>
-<?php
-    foreach ($killers as $k) {
-        //$total = $count['knormal'] + $count['freeze'];
-        $freeze = $k['killer_count_freeze'] > 0 ? "(".$k['killer_count_freeze'].")" : "";
-        echo <<<EOM
-<tr><td>{$k['killer_count_total']}$freeze</td><td>{$k['killer_name']}</td></tr>
-
-EOM;
-    }
-?>
-</table>
-</body>
-</html>
+
+$wt = new WebTemplate();
+$wt->add_head_contents('<link rel="stylesheet" type="text/css" href="css/score-table.css">');
+$wt->set_title("変愚蛮怒 スコア 死因ランキング");
+
+$fp = $wt->main_contents_fp();
+fwrite($fp, <<<EOM
+<h2>変愚蛮怒 死因ランキング</h2>
+<table class="score">
+<thead>
+<tr>
+<th>回数</th>
+<th>彫像・<br>麻痺状態</th>
+<th>死因</th>
+</tr>
+</thead>
+
+EOM
+);
+
+fwrite($fp, "<tboby>\n");
+foreach ($killers as $k) {
+    //$freeze = $k['killer_count_freeze'] > 0 ? "(".$k['killer_count_freeze'].")" : "";
+    fwrite($fp, <<<EOM
+<tr>
+<td class="number">{$k['killer_count_total']}</td>
+<td class="number">{$k['killer_count_freeze']}</td>
+<td>{$k['killer_name']}</td>
+</tr>
+
+EOM
+    );
+}
+fwrite($fp, "</tboby>\n");
+fwrite($fp, "</table>\n");
+
+$wt->print_page();