文件
ParlzPackageManger/web/docs/index.php
T
JGZYES 8877856f68 web: refactor to minimal homepage + docs site
- New minimal index.php: brand hero (+ rotating Earth canvas) + entry cards to
  docs; no multi-page nav.
- New web/docs/ Markdown site: docs/index.php renders sibling .md via the shared
  md() renderer (moved into _common.php). Pages: index/install/download/features/
  cli/mirror/translate/source.
- _common.php: slim nav (首页/文档), add md(), keep PMM_VERSION + layout.
- Delete old multi-pages (features/install/download/servers/source/git/translate)
  and the release/asset serving (releases/, downloads/, root install.sh,
  status.php). Keep web/mirror/ (package registry + lang packs) so the pmm CLI
  and docs download links (GitHub Release) still work.
- assets/style.css: add docs styling. mirror/index.php: fix  deprecation.
- Fix docs install/download links to point at GitHub Release (releases/ removed).

Verified: php -l passes for _common/index/docs/mirror; homepage (globe+hero),
docs pages and mirror render via the PHP built-in server; no stale references
to deleted pages / releases / downloads / status remain.
2026-09-05 11:40:21 +08:00

44 行
1.3 KiB
PHP

<?php
/* PMM docs site — renders sibling .md files with the shared md() renderer.
* URL: docs/index.php?page=<name> (defaults to "index"). */
define('PMM_SITE', 1);
require dirname(__DIR__) . '/_common.php';
/* doc pages: [slug, title] */
$pages = [
'index' => '快速开始',
'install' => '安装',
'download' => '下载',
'features' => '核心特性',
'cli' => '命令参考',
'mirror' => '镜像源',
'translate' => '翻译 / 语言包',
'source' => '源码',
];
$page = isset($_GET['page']) ? (string)$_GET['page'] : 'index';
if (!isset($pages[$page])) $page = 'index';
$title = $pages[$page];
$mdPath = __DIR__ . '/' . $page . '.md';
$body = '';
if (is_file($mdPath)) {
$body = (string)file_get_contents($mdPath);
$body = str_replace("\r", "", $body); // md() regex hard-codes \n
$body = md($body);
}
pmm_header('docs', '文档 · ' . $title);
pmm_page_open('DOCS', $title);
?>
<section class="section">
<div class="wrap">
<nav class="docs-nav">
<?php foreach ($pages as $slug => $t): ?>
<a class="docs-link<?php echo $slug === $page ? ' active' : ''; ?>" href="index.php?page=<?php echo $slug; ?>"><?php echo htmlspecialchars($t); ?></a>
<?php endforeach; ?>
</nav>
<div class="docs-body"><?php echo $body; ?></div>
</div>
</section>
<?php pmm_footer(); ?>