Panel/Panel/modules/website/pages/documentation.php
2026-06-16 10:14:41 -05:00

70 lines
3.6 KiB
PHP

<?php
declare(strict_types=1);
$categoryLabels = [
'panel' => 'Panel Documentation',
'game' => 'Game Servers',
'mods' => 'Mods and Plugins',
'troubleshooting' => 'Troubleshooting',
'other' => 'Other',
];
$groupedDocs = [];
foreach ($docIndex as $entry) {
$groupedDocs[$entry['category']][] = $entry;
}
?>
<section class="page-heading">
<div class="container">
<h1><?= $docEntry !== null ? website_escape($docEntry['name']) : 'Documentation' ?></h1>
<p><?= $docEntry !== null ? website_escape((string)($docEntry['description'] ?? '')) : 'Browse server setup guides, GSP references, mod and Workshop help, and troubleshooting material for both ordinary hosting customers and communities doing more specialized work.' ?></p>
</div>
</section>
<section class="section">
<div class="container">
<?php if ($docEntry !== null && $docContent !== null): ?>
<div class="stack-actions" style="margin-bottom: 18px;">
<a class="button button-secondary" href="<?= website_escape(website_url('docs.php')) ?>">Back to documentation</a>
<a class="button button-ghost" href="<?= website_escape(website_url('index.php')) ?>">Home</a>
</div>
<article class="doc-view">
<?= $docContent ?>
</article>
<?php elseif (!empty($docIndex)): ?>
<div class="doc-list-group">
<?php foreach ($groupedDocs as $category => $entries): ?>
<section>
<div class="section-heading">
<h2><?= website_escape($categoryLabels[$category] ?? ucwords($category)) ?></h2>
<p><?= website_escape(($categoryLabels[$category] ?? $category) . ' to help you configure, troubleshoot, and extend the server you are actually trying to run.') ?></p>
</div>
<div class="doc-grid">
<?php foreach ($entries as $entry): ?>
<article class="doc-card">
<header>
<?php if (!empty($entry['icon_url'])): ?>
<img src="<?= website_escape((string)$entry['icon_url']) ?>" alt="" style="width:56px;height:56px;border-radius:6px;border:1px solid var(--line);margin-bottom:14px;object-fit:cover;">
<?php endif; ?>
<h3><?= website_escape((string)$entry['name']) ?></h3>
<div class="doc-meta"><?= website_escape((string)$entry['category']) ?></div>
</header>
<p><?= website_escape((string)$entry['description']) ?></p>
<div class="card-actions">
<a class="button button-primary" href="<?= website_escape(documentation_url((string)$entry['slug'])) ?>">Open Guide</a>
</div>
</article>
<?php endforeach; ?>
</div>
</section>
<?php endforeach; ?>
</div>
<?php else: ?>
<div class="empty-state">
<h2>Documentation is unavailable</h2>
<p>Documentation is temporarily unavailable. Contact support if you need help with setup, mods, Workshop content, or a custom server configuration.</p>
</div>
<?php endif; ?>
</div>
</section>