Пример #1
0
function post_list()
{
    $posts = scandir("posts/");
    $posts = array_diff($posts, array("..", "."));
    $postDates = array();
    foreach ($posts as $thisPost) {
        $postDates[] = filectime("posts/" . $thisPost);
    }
    $posts = array_combine($postDates, $posts);
    krsort($posts);
    $output = "\n\t<ul id=\"posts\">";
    foreach ($posts as $thisPost) {
        $output .= "\n\t\t<li><a href=\"" . URL . BLOG_DIR . "/post/" . link_name($thisPost) . "\">" . date("Y-m-d", key($posts)) . " - " . format_name($thisPost) . "</a></li>";
    }
    $output .= "\n\t</ul>";
    return $output;
}
Пример #2
0
<?php

$nav = "<ul class=\"nav\">\n";
foreach ($pages as $thisPage) {
    $nav .= "\t\t\t<li id=\"" . $thisPage . "\">\n\t\t\t\t<a href=\"" . URL . BLOG_DIR . "/page/" . link_name($thisPage) . "\">" . format_name($thisPage) . "</a></li>\n";
}
$nav .= "</ul>";
$title = "Just a Blog";
if (isset($_GET['page'])) {
    $thisPage = $_GET['page'];
    $title .= " - " . format_name($thisPage);
}
write_html(file_get_contents("html/header.html"), $title, $blogDir, $nav);