-
Notifications
You must be signed in to change notification settings - Fork 0
/
blogs.php
30 lines (29 loc) · 1.13 KB
/
blogs.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
<?php require_once("includes/header.php"); ?>
<?php
if (isset($_GET['page'])) {
$paginate = new Paginate(Blog::count_items('blogs'), 10, $_GET['page']);
} else {
$paginate = new Paginate(Blog::count_items('blogs'), 10, 1);
}
$all_blogs = Blog::get_all_items('blogs', $paginate->return_offset(), $paginate->num_per_page);
?>
<div class="container__content">
<h1 class="page__headline">Blog Posts</h1>
<?php
foreach ($all_blogs as $blog) {
echo "
<section class='content__section'>
<div class='content__section--content'>
<a href='/blog/blogs/{$blog->id}' class='content__section--link content__section--link-title'><h3 class='content__section--title'>{$blog->title}</h3></a>
<div class='content__section--snippet'>{$blog->show_snippet()}</div>
</div>
<a href='/blog/blogs/{$blog->id}' class='content__section--link content__section--link-picture'><img src='/blog/admin/images/{$blog->picture}' class='content__section--image' alt='{$blog->alt_text}'></a>
</section>
<hr>
";
}
?>
<?php $paginate->show_pagination(); ?>
</div>
</div>
<?php require_once("includes/footer.php"); ?>