-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.php
63 lines (49 loc) · 1.58 KB
/
index.php
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
include 'libs/Parsedown.php';
include 'includes/header.php';
$parser = new Parsedown();
?>
<body>
<div class="container">
<!-- Navigation Bar -->
<?php include 'includes/navigation.php'; ?>
<div class="row">
<div class="col-lg-8">
<?php
foreach ($blogSystem->getPosts() as $post) {
# for getting the name, since we only have the subjects id
$subject_handle = $blogSystem->getSubjectById($post['subject_id']);
# store the id of the owner
$user_id = $post['owner_id'];
# information about the user with the given id
$user_handle = $pesto->getUser($user_id);
# the username taken from the user record
$username = $user_handle['username'];
# reformat the date to something more readable
$formatted_date = date("d M Y", strtotime($post['date']));
echo '
<div class="post">
<h1 class="post-title">'. $post['title']. '</h1>
<h5 class="post-meta text-muted"><a href="#">' . $username . '</a> · '. $formatted_date .' · Subject: <a href="#">'. $subject_handle['subject'] .'</a></h5>
<div class="post-content">'
. $parser->text($post['content']) .
'</div>
<div class="small-space"></div>
<a href="#" class="btn btn-primary btn-sm">Read More</a>
</div>
';
}
?>
</div>
<div class="col-lg-4">
<h1>About</h1>
<p>
<?php
echo $parser->text($blog_desc);
?>
</p>
</div>
</div>
</div>
</body>
<?php include 'includes/footer.php'; ?>