forked from SAAR-IITP/SAAR-IITP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload.php
79 lines (70 loc) · 2.96 KB
/
load.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
session_start();
if(isset($_GET['offset']) && isset($_GET['limit'])){
$offset = $_GET['offset'];
$lim = $_GET['limit'];
$url = 'http://api.saar.iitp.ac.in/getPosts.php?offset='.$offset.'&limit='.$lim;
$response = file_get_contents($url);
// echo $response;
$response = json_decode($response,true);
$datas = $response['data'];
foreach($datas as $data){
if(strlen($data['body']) >= 200){
$data['body'] .= '....';
}
echo '
<div class="jumbotron">
<div class="media">
<div class="col-lg-1 col-sm-2">
<img src="'.$data['user_img'].'" class="mr-3" alt="..." style="width: 64px;height: 64px">
<div class="username"><strong>'.$data['user_name'].'</strong></div>
</div>
<div class="col-lg-9 col-sm-8">
<div class="media-body">
<a class="display-4 post_heading" href="./post.php?q='.$data['id'].'">'.$data['title'].' </a>
<p>'.$data['body'].'</p>
<a href="./post.php?q='.$data['id'].'" color="blue"> read more ...</a>
<hr style="margin-top:10px">
<span>
<div style="display: inline-block; cursor: pointer;">
<i class="fa fa-commenting" aria-hidden="true"></i> '.$data['no_of_comment'].'
</div>
<div style="display: inline-block; cursor: pointer;">
</div>
<div class="up" id="upvote_post" style="display: inline-block; cursor: pointer;">
<i class="fa fa-thumbs-up"></i> '.$data['upvotes'].'
</div>
<div class="down" id="downvote_post" style="display: inline-block; cursor: pointer;">
<i class="fa fa-thumbs-down"></i> '.$data['downvotes'].'
</div>
</span>
<div class="post_time" style="">'.$data['post_time'][0].' at '.$data['post_time'][1].'</div>
</div>
</div>
</div>
</div>
';
}
}
// old Interface
// <div class="jumbotron">
// <div class="row">
// <div class="col-lg-1 col-sm-2 res">
// <img src="'.$data['user_img'].'" class="profile_image" style=""></img>
// <div class="username"><strong>'.$data['user_name'].'</strong></div>
// </div>
// <div class="col-lg-9 col-sm-8">
// <a class="display-4 post_heading" href="./post.php?q='.$data['id'].'">'.$data['title'].' </a>
// <hr style="margin-top:10px">
// <p class="post_body">'.$data['body'].'</p>
// <p class="lead">
// <a class="btn btn-primary btn-md" href="./post.php?q='.$data['id'].'" role="button">Read more</a>
// </p>
// </div>
// <div class="col-lg-2 col-sm-2">
// <div class="post_comment"> '.$data['no_of_comment'].' Comments</div>
// <div class="post_time" style=""><i class="fa fa-clock-o"></i> '.$data['post_time'][0].' at '.$data['post_time'][1].'</div>
// </div>
// </div>
// </div>
?>