-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
60 lines (54 loc) · 1.33 KB
/
index.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
<?php
session_start();
include "include/function.php";
?>
<!DOCTYPE html>
<html>
<?php
head("Home", "index");
?>
<body>
<?php
include "include/header.php";
?>
<main>
<section>
<!--
<header>
<h1>سینما</h1>
</header>
-->
<?php
$query = " SELECT `post`.`id`, `title`, `memo`, `image`, `category_id`, `category`.`name` AS 'category_name'
FROM `post` LEFT JOIN `category` ON `post`.`category_id` = `category`.`id`
ORDER BY `post`.`id` DESC LIMIT 10 ";
$select = $db->execute($query);
$posts = $select->fetch_all(MYSQLI_ASSOC);
foreach ($posts as $item) {
echo '
<div class="post">
<img src="'.url_post_image($item['image']).'" alt="'.$item['title'].'">
<div class="info">
<h1>'.$item['title'].'</h1>
<span>دسته بندی: <a href="'.url_category($item['category_id']).'">'.$item['category_name'].'</a></span>
<p>'.mb_substr($item['memo'], 0, 150).'...</p>
<a href="'.url_post($item['id']).'" class="read-more">بیشتر</a>
</div>
</div>
';
}
?>
<ul class="pages">
<li class="active">1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
</section>
</main>
<?php
include "include/aside.php";
include "include/footer.php";
?>
</body>
</html>