2020-08-16 05:25:54 -05:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-meta.php';?>
|
|
|
|
<link rel="shortcut icon" href="/favicon.ico" />
|
|
|
|
<title>9iron - Posts</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-header.php';?>
|
|
|
|
<div class="content">
|
|
|
|
<div class="section">
|
2020-08-16 05:42:54 -05:00
|
|
|
<h1>Posts</h1>
|
2020-08-16 05:25:54 -05:00
|
|
|
<p>Included is a list of all blog posts I've written here, latest first. I try to post as frequently as I can make an excuse to.</p>
|
|
|
|
<p>It's also got a <a href="/feed">feed</a> if you want it.</p>
|
|
|
|
<dl>
|
|
|
|
<?php
|
|
|
|
$dir = $_SERVER['DOCUMENT_ROOT']."/posts/";
|
|
|
|
$posts = scandir($dir, 1);
|
|
|
|
$ignore = array("index.php", "feed.php", ".", "..");
|
|
|
|
$extensions = array(".php", ".html", ".htm");
|
|
|
|
foreach ($posts as &$post) {
|
|
|
|
// See if it's a blacklisted file
|
|
|
|
if (in_array($post, $ignore)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$postlocation = $_SERVER['DOCUMENT_ROOT']."/posts/".$post;
|
|
|
|
$posturl = "/posts/".$post;
|
|
|
|
// Get the title
|
|
|
|
$title = "Title not available";
|
|
|
|
$summary = "Summary not available";
|
|
|
|
$dom = new DOMDocument();
|
|
|
|
if ($dom->loadHTMLFile($postlocation)) {
|
|
|
|
$xpath_section = new DOMXpath($dom);
|
|
|
|
$list = $dom->getElementsByTagName("title");
|
|
|
|
if ($list->length > 0) {
|
|
|
|
$title = $list->item(0)->textContent;
|
|
|
|
}
|
|
|
|
$list = $xpath_section->query('//div[@class="section"]//p');
|
|
|
|
if ($list->length > 0) {
|
|
|
|
$summary = $list->item(0)->nodeValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Produce a list item
|
|
|
|
$post = str_replace($extensions, "", $post);
|
|
|
|
$title = str_replace("9iron - ", "", $title);
|
2020-08-16 12:39:03 -05:00
|
|
|
echo "<a href=\"$posturl\"><div class=\"subcontainer\"><h3>$post: $title</h3><p>$summary</p></div></a>";
|
2020-08-16 05:25:54 -05:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php include $_SERVER['DOCUMENT_ROOT'].'/src/common-footer.php';?>
|
|
|
|
</body>
|
|
|
|
</html>
|