clan info on main page

This commit is contained in:
Lanta 2023-11-16 14:24:52 +01:00
parent ee824a4267
commit 7421e7a820
2 changed files with 80 additions and 48 deletions

View file

@ -4,7 +4,10 @@
<body>
<?php include './includes/navigation.php'; ?>
<?php
include './includes/navigation.php';
include './config/config.php';
?>
<header>
<img src="./images/banner2.png" alt="banner" class="banner">
</header>
@ -12,7 +15,7 @@
<section>
<h2>Clan Stats</h2>
<?php
include './config/config.php';
// Load clan data from claninfo.json
$clanInfoPath = './data/claninfo.json';

View file

@ -25,6 +25,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
<!DOCTYPE html>
<html lang="en">
<?php include './includes/head.php'; ?>
<body>
<?php include './includes/navigation.php'; ?>
@ -37,7 +38,7 @@ $lastMatches = array_slice($allMatches, 0, 8);
<h2>Latest Matches</h2>
<table>
<thead>
<tr>
<!-- <th>Match Date</th> -->
<th>Player Name</th>
@ -48,8 +49,8 @@ $lastMatches = array_slice($allMatches, 0, 8);
<th>Damage</th>
<th>Place</th>
</tr>
</thead>
<tbody>
<?php
$mapNames = array(
"Baltic_Main" => "Erangel",
@ -79,9 +80,36 @@ $lastMatches = array_slice($allMatches, 0, 8);
</tr>";
} ?>
</tbody>
</table>
</table>
<h2>Clan Stats</h2>
<?php
// Load clan data from claninfo.json
$clanInfoPath = './data/claninfo.json';
$clanmembersfile = './config/clanmembers.json';
$clanmembers = json_decode(file_get_contents($clanmembersfile), true);
if (file_exists($clanInfoPath)) {
$clan = json_decode(file_get_contents($clanInfoPath), true);
if (isset($clan) && !empty($clan)) {
echo "<table>";
echo "<tr><th>Attribute</th><th>Value</th></tr>";
foreach ($clan as $key => $value) {
echo "<tr><td>" . htmlspecialchars($key) . "</td><td>" . htmlspecialchars($value) . "</td></tr>";
}
foreach ($clanmembers['clanMembers'] as $value) {
echo "<tr><td><a href='latestmatches.php?selected_player=" . htmlspecialchars($value) . "'>name</a></td><td><a href='latestmatches.php?selected_player=" . htmlspecialchars($value) . "'>" . htmlspecialchars($value) . "</a></td></tr>";
}
echo "</table>";
} else {
echo "<p>No clan attributes available</p>";
}
} else {
echo "<p>Clan info file missing</p>";
}
?>
</section>
@ -90,4 +118,5 @@ $lastMatches = array_slice($allMatches, 0, 8);
<?php include './includes/footer.php'; ?>
</body>
</html>