-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle_article.php
More file actions
150 lines (113 loc) · 6.84 KB
/
Copy pathsingle_article.php
File metadata and controls
150 lines (113 loc) · 6.84 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php include "assest/head.php"; ?>
<?php
$article_id = $_GET['id'];
// Get Article Info
$stmt = $conn->prepare("SELECT * FROM `article` INNER JOIN `author` ON `article`.id_author = `author`.author_id WHERE `article_id` = ?");
$stmt->execute([$article_id]);
$article = $stmt->fetch();
// Get Category of article
$stmt = $conn->prepare("SELECT * FROM `category` WHERE `category_id` = ?");
$stmt->execute([$article["id_categorie"]]);
$category = $stmt->fetch();
// Get Author's articles
$stmt = $conn->prepare("SELECT article_title, article_id FROM `article` WHERE id_author = ? LIMIT 4");
$stmt->execute([$article["id_author"]]);
$articles = $stmt->fetchAll();
// Get Comments
$stmt = $conn->prepare("SELECT * FROM `article` INNER JOIN `comment` WHERE `article`.`article_id`= `comment`.`id_article` AND `article`.`article_id` = ? ORDER BY comment_id DESC");
$stmt->execute([$article_id]);
$comments = $stmt->fetchAll();
?>
<!-- Custom CSS -->
<link type="text/css" rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/single_article.css">
<title>Single Article</title>
</head>
<body>
<!-- Header -->
<?php include "assest/header.php" ?>
<!-- /Header -->
<!-- Main -->
<main role="main" class="bg-l py-4">
<div class="container">
<div class="row">
<!-- Article -->
<div class="content bg-white col-lg-9 p-0 border border-muted">
<!-- Post Content -->
<div class="post__content w-75 mx-auto">
<div class="post-head text-center my-5">
<h1 class="post__title">
<?= $article["article_title"] ?>
</h1>
<div class="post-meta ">
<span class="post__date">
<?= date_format(date_create($article["article_created_time"]), "F d, Y ") ?>
</span>
<a class="post-category" href="articleOfCategory.php?catID=<?= $category['category_id'] ?>" style="background-color:<?= $category['category_color'] ?>">
<?= $category['category_name'] ?>
</a>
</div>
</div>
<div class="post-body text-break">
<?= $article["article_content"] ?>
</div>
<!-- author Info -->
<div class="post-footer d-flex my-5">
<img class="profile-thumbnail rounded-circle pr-2" src="img/avatar/<?= $article['author_avatar'] ?>" alt="test avatar image" style="width: 120px;height: 120px;">
<div class="d-flex flex-column justify-content-around">
<h3 class="font-italic mb-1"><?= $article['author_fullname'] ?></h3>
<p class="text-muted mb-1"><?= $article['author_desc'] ?></p>
<div class="social_media">
<a href="https://twitter.com/<?= $article['author_twitter'] ?>" class="mr-3"><i class="fa fa-twitter"></i><span class="px-1"><?= $article['author_twitter'] ?></span></a>
<a href="https://github.com/<?= $article['author_github'] ?>" class="mr-3"><i class="fa fa-github"></i><span class="px-1"><?= $article['author_github'] ?></span></a>
<a href="https://linkedin.com/in/<?= $article['author_link'] ?>" class="mr-3"><i class="fa fa-linkedin-square"></i><span class="px-1"><?= $article['author_link'] ?></span></a>
</div>
</div>
</div>
</div>
</div><!-- /Article -->
<!-- Aside -->
<div class="aside col-3">
<!-- Author Info -->
<div class="p-3 bg-white border border-muted">
<div class="d-flex align-items-center">
<img class="profile-thumbnail rounded-circle" src="img/avatar/<?= $article['author_avatar'] ?>" alt="test avatar image" style="width: 60px;height: 60px;">
<h5 class="font-italic m-0"><?= $article['author_fullname'] ?></h5>
</div>
<p class="author_desc p-1"><?= $article['author_desc'] ?></p>
<div class="d-flex flex-column justify-content-between">
<div class="author_links">
<a href="https://twitter.com/<?= $article['author_twitter'] ?>" class="mr-3"><i class="fa fa-lg fa-twitter"></i></a>
<a href="https://github.com/<?= $article['author_github'] ?>" class="mr-3"><i class="fa fa-lg fa-github"></i></a>
<a href="https://linkedin.com/in/<?= $article['author_link'] ?>" class="mr-3"><i class="fa fa-lg fa-linkedin-square"></i></a>
</div>
</div>
</div><!-- /Author Info -->
<!-- Other articles -->
<!-- <div class="p-3 bg-white border border-muted">
<div class="d-flex align-items-center">
<img class="profile-thumbnail rounded-circle" src="img/avatar/<?= $article['author_avatar'] ?>" alt="test avatar image" style="width: 60px;height: 60px;">
<h5 class="font-italic"><?= $article['author_fullname'] ?></h5>
</div>
<p class="author_desc"><?= $article['author_desc'] ?></p>
</div> -->
<div class="card bg-light my-3">
<div class="card-header"><strong> More from <?= $article['author_fullname'] ?></strong></div>
<ul class="list-group list-group-flush">
<?php foreach ($articles as $article) : ?>
<li class="list-group-item"><a href="single_article.php?id=<?= $article['article_id'] ?>"><?= $article['article_title'] ?></a></li>
<!-- <li class="list-group-item"><a href="">How To Create A Simple With CSS</a></li>
<li class="list-group-item"><a href="">How To Parallax Style Effect With CSSs</a></li> -->
<?php endforeach; ?>
</ul>
</div>
<!-- /Other articles -->
</div><!-- /Aside -->
</div>
</div>
</main><!-- /Main -->
<!-- Footer -->
<?php include "assest/footer.php" ?>
<!-- /Footer -->
</body>
</html>