-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.php
46 lines (39 loc) · 1.7 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
<?php
require_once 'functions/helpers.php';
require_once 'functions/pdo_connection.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bit Blog</title>
<link rel="stylesheet" href="<?= asset('assets/css/bootstrap.min.css') ?>" media="all" type="text/css">
<link rel="stylesheet" href="<?= asset('assets/css/style.css') ?>" media="all" type="text/css">
</head>
<body>
<section id="app">
<?php require_once "layouts/top-nav.php"?>
<section class="container my-5">
<!-- Example row of columns -->
<section class="row">
<?php
$query = "SELECT * FROM posts WHERE status = 10";
$statement = $pdo->prepare($query);
$statement->execute();
$posts = $statement->fetchAll();
foreach ($posts as $post) { ?>
<section class="col-md-4">
<section class="mb-2 overflow-hidden" style="max-height: 15rem;"><img class="img-fluid" src="<?= asset($post->image) ?>" alt=""></section>
<h2 class="h5 text-truncate"><?= $post->title ?></h2>
<p><?= substr($post->body, 0, 80) ?></p>
<p><a class="btn btn-primary" href="<?= url('detail.php?post_id=') . $post->id ?>" role="button">View details »</a></p>
</section>
<?php } ?>
</section>
</section>
</section>
<script src="<?= asset('assets/js/jquery.min.js') ?>"></script>
<script src="<?= asset('assets/js/bootstrap.min.js') ?>"></script>
</body>
</html>