43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
$strPath = "/";
|
|
$strPath .= implode("/", Request::getPathParts());
|
|
|
|
global $c;
|
|
|
|
$c->query(
|
|
"CREATE table if not exists post (
|
|
id integer primary key autoincrement,
|
|
author text not null,
|
|
path text not null,
|
|
content text not null,
|
|
created timestamp not null default current_timestamp,
|
|
updated timestamp not null default current_timestamp)");
|
|
|
|
$varPosts = $c->query(
|
|
"SELECT *
|
|
from post
|
|
where
|
|
path like ?
|
|
or path like '*'",
|
|
$strPath);
|
|
|
|
$varParsedown = new Parsedown();
|
|
?>
|
|
|
|
<?php foreach ($varPosts as $p): ?>
|
|
<div class="container my-5">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="border border-secondary rounded p-3">
|
|
<?php
|
|
$strContent = $varParsedown->text($p["content"]);
|
|
echo $strContent;
|
|
?>
|
|
</div>
|
|
<a href="/edit/<?= $p["id"]; ?>">edit</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<?php endforeach; ?>
|