-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_added.php
36 lines (34 loc) · 1.03 KB
/
new_added.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
<?php
include('includes/header.php');
if(!$user->isLoggedIn()){
Session::flash('index', "Please log in!");
Redirect::to('index.php');
}
$numberOfPost = 30;
$post = new Post();
$posts = $post->getAll(1, $numberOfPost);#get $numberOfPost post according to sorted created_date
?>
<div align="center">
<?php
if(empty($posts)){
echo '<h2>We do not have any new post, can you <a href="add_post.php"><span class="label label-primary">Share it</span></a> now?</h2>';
}else{
$row_number = (count($posts) / 3) + 1;
for($i = 1; $i <= $row_number; $i++){
echo '<div class="row">';#row aç
for($j = 1; $j <= 3; $j++){
$post_number = ( ($i-1)*3 + $j ) - 1;
if($post_number >= count($posts))
break;
$current_post = $posts[$post_number];#get next element
echo '<div class="col-sm-6 col-md-4">';#sütun aç
include 'includes/thumbnail.php';#take $current_post as a parameter
echo '</div>';#sütun kapa
}
echo '</div>';#row kapa
}
}
?>
<?php
include('includes/footer.php');
?>