Commit ac63f89f authored by Stuart John Watson's avatar Stuart John Watson

Game status data is now php populated for no-script support

parent b8774510
......@@ -11,11 +11,19 @@
foreach ($GAMES_TO_INCLUDE as $game){
include "$game.php";
$a = "$game\\getInfo";
$gameInfo[$game] = $a();
$thisGame = $a();
$gameInfo[$game] = $thisGame;
if ($templateHeader !== FALSE){
echo $templateHeader;
echo "<div data-target=\"$game\">";
echo file_get_contents("$game.html");
echo preg_replace_callback("/{{([^|]*)\|([^}]*)}}/",function ($matches) use ($thisGame){
$elem = $matches[1];
$key = $matches[2];
$val = $thisGame[$key];
return "<$elem data-target='$key'>$val</$elem>";
},file_get_contents("$game.html"));
echo "</div>";
echo $templateFooter;
}
......
<h2>Minecraft - <span data-target="_online"></span></h2>
<h2>Minecraft - {{span|_online}}</h2>
<dl>
<dt>Players:</dt>
<dd>
<span data-target="players_on"></span>/<span data-target="players_max"></span>
{{span|players_on}}/{{span|players_max}}
</dd>
<dt>Version:</dt>
<dd>
<span data-target="version"></span>
{{span|version}}
</dd>
</dl>
......
<h2>Sauerbraten - <span data-target="_online"></span></h2>
<h2>Sauerbraten - {{span|_online}}</h2>
<dl>
<dt>Players:</dt>
<dd>
<span data-target="players_on"></span>/<span data-target="players_max"></span>
{{span|players_on}}/{{span|players_max}}
</dd>
<dt>Game Mode:</dt>
<dd>
<span data-target="gameMode"></span>
{{span|game_mode}}
</dd>
<dt>Map:</dt>
<dd>
<span data-target="map"></span>
{{span|map}}
</dd>
</dl>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment