first
This commit is contained in:
30
public_html/blog/index.php
Normal file
30
public_html/blog/index.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
ini_set("display_errors", "On");
|
||||
error_reporting(E_ALL);
|
||||
include '../parts/header.php';
|
||||
?>
|
||||
<div id="top-bar">
|
||||
<h1>> Blog</h1>
|
||||
</div>
|
||||
|
||||
<article id="content">
|
||||
<div class="post">Poniżej znajdziesz listę wszystkich postów na blogu ~<<USER>></div>
|
||||
<?php
|
||||
$posts_dir = 'posts/';
|
||||
$posts = array_diff(scandir($posts_dir), array('..', '.'));
|
||||
foreach ($posts as $post) {
|
||||
$f = fopen("posts/$post", "r");
|
||||
$line = fgets($f);
|
||||
fclose($f);
|
||||
$data = substr(substr($line, 4), 0, -4);
|
||||
$post_data = explode(";%%%;", $data);
|
||||
$title = $post_data[0];
|
||||
$date = $post_data[1];
|
||||
|
||||
echo "<div class=\"post\"><i class=\"post_date\">$date</i> - <a href=\"posts/$post\" class=\"link\">$title</a></div>";
|
||||
}
|
||||
?>
|
||||
</article>
|
||||
<?php
|
||||
include '../parts/footer.php';
|
||||
?>
|
||||
Reference in New Issue
Block a user