2019-09-14 18:29:05 +00:00
|
|
|
<?php
|
|
|
|
$title = "tilde.club wiki";
|
|
|
|
include __DIR__."/../header.php";
|
|
|
|
?>
|
2020-05-07 05:41:08 +00:00
|
|
|
<h1 id="fancyboi">the tilde.club wiki</h1>
|
2020-05-06 07:50:51 +00:00
|
|
|
<div class="grid">
|
|
|
|
<div class="row">
|
|
|
|
<div class="col">
|
2025-01-22 21:29:18 +00:00
|
|
|
<p>Here's the articles on our wiki:</p>
|
|
|
|
<ul>
|
|
|
|
<?php
|
|
|
|
// category order
|
|
|
|
$order = ['tilde.club', 'tutorials', 'software', 'links'];
|
|
|
|
|
|
|
|
$category_to_articles = [];
|
2019-09-14 18:29:05 +00:00
|
|
|
|
2025-01-22 21:29:18 +00:00
|
|
|
// get articles
|
|
|
|
foreach (glob("source/*.md") as $file)
|
|
|
|
{
|
2020-04-12 08:09:33 +00:00
|
|
|
$article = basename($file, ".md");
|
2025-01-22 21:29:18 +00:00
|
|
|
$title = preg_match("/title: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : $article;
|
2025-01-23 11:05:06 +00:00
|
|
|
$title = ucfirst($title);
|
2025-01-22 21:29:18 +00:00
|
|
|
$category = preg_match("/category: (.*)/i", file_get_contents($file), $matches) ? $matches[1] : 'default';
|
|
|
|
|
|
|
|
if (array_key_exists($category, $category_to_articles))
|
|
|
|
array_push($category_to_articles[$category], [$article, $title]);
|
|
|
|
else
|
|
|
|
$category_to_articles[$category] = [[$article, $title]];
|
|
|
|
|
2020-04-13 05:21:15 +00:00
|
|
|
ksort($category_to_articles);
|
2025-01-22 21:29:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($order as $category)
|
|
|
|
{
|
|
|
|
echo '<li>'.ucwords($category).'</li>';
|
|
|
|
echo '<ul>';
|
|
|
|
|
|
|
|
$article_titles = [];
|
|
|
|
$article_names = [];
|
|
|
|
|
|
|
|
foreach ($category_to_articles[$category] as $article)
|
|
|
|
{
|
|
|
|
array_push($article_names, $article[0]);
|
|
|
|
array_push($article_titles, $article[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
$name_to_title = array_combine($article_names, $article_titles);
|
2020-04-13 05:21:15 +00:00
|
|
|
asort($name_to_title);
|
2025-01-22 21:29:18 +00:00
|
|
|
|
|
|
|
foreach ($name_to_title as $name => $title)
|
|
|
|
echo '<li><a href="/wiki/'.$name.'.html">'.$title.'</a></li>';
|
|
|
|
|
|
|
|
echo '</ul><br>';
|
2020-04-13 05:21:15 +00:00
|
|
|
|
2025-01-22 21:29:18 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</ul>
|
2020-05-06 07:50:51 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2025-01-22 21:29:18 +00:00
|
|
|
<?php include "../footer.php";
|