add post viewing basis, add insert post and comment queries
This commit is contained in:
53
website/views/post-view.php
Normal file
53
website/views/post-view.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// $postID = $_GET['postID'];
|
||||
$postID = 1;
|
||||
$post = selectPostById($postID)->fetch(PDO::FETCH_ASSOC);
|
||||
$fullname = $post['fname'] . " " . $post['lname'] . " (" . $post['username'] . ")";
|
||||
?>
|
||||
|
||||
<div class="post-header">
|
||||
<h4><?php echo $post['title'];?></h4>
|
||||
<span class="postinfo">
|
||||
gepost door <?php echo $fullname;?>,
|
||||
<span class="posttime" title="<?php echo $post['creationdate']?>">
|
||||
<?php echo nicetime($post['creationdate']); ?>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="post-content">
|
||||
<p><?php echo $post['content']; ?></p>
|
||||
</div>
|
||||
|
||||
<div class="post-comments">
|
||||
<div class="commentfield">
|
||||
<form name="newcomment" method="post">
|
||||
<textarea>Vul in</textarea> <br>
|
||||
<input type="submit" value="Reageer">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$q = selectCommentsByPostId($postID);
|
||||
while($comment = $q->fetch(PDO::FETCH_ASSOC)) {
|
||||
$commentauthor = $comment['fname'] . " " . $comment['lname'] . " (" . $comment['username'] . ")";
|
||||
$commentdate = $comment['creationdate'];
|
||||
$commentnicetime = nicetime($commentdate);
|
||||
$commentcontent = $comment['content'];
|
||||
|
||||
echo("
|
||||
<div class='comment'>
|
||||
<div class='commentinfo'>
|
||||
$commentauthor
|
||||
<span class='commentdate', title='$commentdate'>
|
||||
$commentnicetime
|
||||
</span>
|
||||
</div>
|
||||
<div class='commentcontent'>
|
||||
$commentcontent
|
||||
</div>
|
||||
</div>
|
||||
");
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
@@ -66,4 +66,13 @@
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="modal content">
|
||||
<div class="modal-content">
|
||||
<div class="modal-close">
|
||||
×
|
||||
</div>
|
||||
<?php include("../views/post-view.php"); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user