blob: 162babc6e7e164369165ca59d2f5247bb6735172 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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>
|