-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblog.php
More file actions
105 lines (103 loc) · 4.47 KB
/
blog.php
File metadata and controls
105 lines (103 loc) · 4.47 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
<?php require_once('include/header.php');
$postResponse = $mFunction->getPosts();
?>
<?php
// fetching the data from the database server if found title on url
if(isset($_GET['post']))
{
$blog_post_title = htmlentities($_GET['post']);
$mFunction = new Functions;
$post = $mFunction->getPostByPostTitle($blog_post_title);
}
else
{
header("LOCATION:index.php");
}
?>
<main>
</main>
<body class="mufazmi blue lighten-5" >
<?php require_once('include/navbar.php'); ?>
<?php
// if rows is less than one means the title which is in url baar is not matching with any data from the database server
// so here we are going to print the 404 error image instead of using blank page here
if(empty($post->postId)){ ?>
<div class="center">
<br><br><br> <br><br>
<h1 class="center blue-text text-lighten-1" style="font-size:150px;"><b>404</b></h1>
<h5 class="center grey-text">Sorry, Post not found.</h5>
<a href="home"><i class=" large material-icons">home</i></a>
<br><br><br><br> <br> <br><br>
</div>
<?php
require_once('include/footer.php');
exit();
}
$postCard = <<<HERE
<div class="card z-depth-0">
<img src="uploads/$post->postImage" alt="" style=" width:100%; object-fit:cover;" class="responsive-img" >
<p style="font-size: 18px; padding:20px">$post->postContent</p>
</div>
HERE;;
?>
<!-- container tag starting form here -->
<div class="container">
<div class="center-align">
<h3 style="font-weight: bold;"><?php echo $post->postTitle; ?></h3>
<p class="grey-text"><?php echo $post->postTimestamp; ?></p>
<!-- starting chip / tag section from here -->
<div class="chip">
Social Codia
</div>
<div class="chip">
javascript
</div>
<div class="chip">
Python
</div>
</div>
</div>
<!-- Page title tags end here -->
<!-- Row begins -->
<div class="row">
<div class="col s12 m8 l8 offset-l1">
<?php
echo $postCard;
?>
</div>
<div class="col s12 m4 l3">
<div class="card-image">
<a href="http://socialcodia.com" target="_blank">
<img src="img/advertSocialCodia.png" alt="" style="width: 500px; height:;" class="responsive-img">
</a>
</div>
<div class="card z-depth-0">
<div class="card-"> <br>
<h5 class="center"><i class="material-icons ">face</i>Trending</h5>
<?php
foreach ($postResponse as $post) {
$postCard = <<<HERE
<a href="?post=$post->postTitle" class="">
<div class="col s2 m2 l5">
<img src="uploads/$post->postImage" style="height:60px; width:100%; object-fit:cover;" alt="" class="responsive-img">
</div>
<div class="row">
<div class="col s10 m10 l7">
<span><b>$post->postTitle</b></span>
</div>
</div>
</a>
HERE;;
echo $postCard;
}
?>
</div>
</div>
</div>
</div>
<div class="center hide-on-small-only">
<a href="http://socialcodia.com" target="_blank">
<img src="img/970x90.png" class="responsive-im" alt="">
</a>
</div>
<?php require_once('include/footer.php'); exit(); ?>