~hxii/picoblog

picoblog/blog.php -rw-r--r-- 922 bytes
5ca882f3 — Paul (hxii) Glushak Init commit 11 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php

// Inlcude the file
include_once 'picoblog.php';

// Instantiate the class with the source file
$mb = new \hxii\PicoBlog('blog.txt');

// Parse query string and get blog entries
$query = $mb->parseQuery();
$entries = ($query) ? $mb->getEntries($query) : $mb->getEntries('all');

?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>picoblog @ <?= $_SERVER['HTTP_HOST'] ?></title>
</head>

<body>
    <h1>picoblog</h1>
    <?php
    // Display message and link to main list if viewing a filtered entry list
    if ($query) {
        echo '<div>Currently viewing ' . implode('', $query) . '. Back to <a href="' . $_SERVER['PHP_SELF'] . '">list?</a></div>';
    }
    ?>
    <ol>
        <!-- Render entries -->
        <?= $mb->renderEntries($entries, '<li class="e">{entry}</li>'); ?>
    </ol>
</body>

</html>