aboutsummaryrefslogtreecommitdiff
path: root/includes/blog
diff options
context:
space:
mode:
authorMinteck <46352972+Minteck@users.noreply.github.com>2021-07-20 01:15:15 +0200
committerMinteck <46352972+Minteck@users.noreply.github.com>2021-07-20 01:15:15 +0200
commitaf9e5ef458b93ef2003905e1ccc5665e7266c242 (patch)
tree989ac25a8b75578788cd7157308f37b9b83cf8f5 /includes/blog
downloadmain-af9e5ef458b93ef2003905e1ccc5665e7266c242.tar.gz
main-af9e5ef458b93ef2003905e1ccc5665e7266c242.tar.bz2
main-af9e5ef458b93ef2003905e1ccc5665e7266c242.zip
Commit
Diffstat (limited to 'includes/blog')
-rw-r--r--includes/blog/data/2020-05-01@something.json3
-rw-r--r--includes/blog/data/2020-05-01@something.json.html1
-rw-r--r--includes/blog/home.php24
-rw-r--r--includes/blog/list.php14
4 files changed, 42 insertions, 0 deletions
diff --git a/includes/blog/data/2020-05-01@something.json b/includes/blog/data/2020-05-01@something.json
new file mode 100644
index 0000000..51021ea
--- /dev/null
+++ b/includes/blog/data/2020-05-01@something.json
@@ -0,0 +1,3 @@
+{
+ "title": "Some article"
+} \ No newline at end of file
diff --git a/includes/blog/data/2020-05-01@something.json.html b/includes/blog/data/2020-05-01@something.json.html
new file mode 100644
index 0000000..12ed35a
--- /dev/null
+++ b/includes/blog/data/2020-05-01@something.json.html
@@ -0,0 +1 @@
+<b>This is some <i>test</i></b><u> or, <i>is it?</i></u>... We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. We would never know if there really should be any text or whatever thingy just in that place right here. \ No newline at end of file
diff --git a/includes/blog/home.php b/includes/blog/home.php
new file mode 100644
index 0000000..162babc
--- /dev/null
+++ b/includes/blog/home.php
@@ -0,0 +1,24 @@
+<div class="card-group">
+ <?php
+
+ $articles = scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data");
+ $i = 1;
+ foreach ($articles as $article):
+
+ ?>
+ <?php if ($i <= 3 && strpos($article, "@") !== false && strpos($article, ".html") === false): ?>
+ <?php
+ $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $article), true);
+ $data['html'] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $article . ".html");
+ ?>
+ <div class="card">
+ <div class="card-body">
+ <h5 class="card-title"><?= $data["title"] ?></h5>
+ <p class="card-text"><?= strlen(strip_tags($data["html"])) > 150 ? substr(strip_tags($data["html"]), 0, 150) . "..." : strip_tags($data["html"]) ?></p>
+ <p class="card-text"><small class="text-muted"><?= l("Published", "Publié") ?> <?= DateTime::createFromFormat('Y-m-d', explode("@", $article)[0])->format("F jS, Y"); ?></small></p>
+ <a href="/blog/article-<?= explode(".", $article)[0] ?>" class="card-link"><?= l("Read more...", "Lire plus...") ?></a>
+ </div>
+ </div>
+ <?php endif;$i++; ?>
+ <?php endforeach; ?>
+</div> \ No newline at end of file
diff --git a/includes/blog/list.php b/includes/blog/list.php
new file mode 100644
index 0000000..5166966
--- /dev/null
+++ b/includes/blog/list.php
@@ -0,0 +1,14 @@
+<div class="list-group">
+ <?php
+
+ $articles = scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data");
+ $i = 1;
+ foreach ($articles as $article):
+
+ ?>
+ <?php if (strpos($article, "@") !== false && strpos($article, ".html") === false): ?>
+ <?php $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/" . $article), true); ?>
+ <a href="/blog/article-<?= explode(".", $article)[0] ?>" class="list-group-item list-group-item-action"><span class="text-muted"><?= DateTime::createFromFormat('Y-m-d', explode("@", $article)[0])->format("F jS, Y"); ?></span> · <?= $data["title"] ?></a>
+ <?php endif;$i++; ?>
+ <?php endforeach; ?>
+</div> \ No newline at end of file