-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle.php
More file actions
44 lines (32 loc) · 970 Bytes
/
article.php
File metadata and controls
44 lines (32 loc) · 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require 'includes/init.php';
$conn = require 'includes/db.php';
if (isset($_GET['id'])) {
// oude
//$article = Article::getByID($conn, $_GET['id']);
// nu met categories
$article = Article::getWithCategories($conn, $_GET['id']);
} else {
$article = null;
}
?>
<?php require 'includes/header.php'; ?>
<?php if ($article) : ?>
<article>
<h2><?= htmlspecialchars($article[0]['title']); ?></h2>
<?php if ($article[0]['category_name']) : ?>
<p>Categories:
<?php foreach ($article as $a) : ?>
<?= htmlspecialchars($a['category_name']); ?>
<?php endforeach; ?>
</p>
<?php endif; ?>
<?php if ($article[0]['image_file']) : ?>
<img src="/cms/uploads/<?= $article[0]['image_file']; ?>">
<?php endif; ?>
<p><?= htmlspecialchars($article[0]['content']); ?></p>
</article>
<?php else: ?>
<p>Article not found.</p>
<?php endif; ?>
<?php require 'includes/footer.php'; ?>