-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcategory.php
64 lines (40 loc) · 1.54 KB
/
category.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
<?php
/*
Author: Nathan Brettell
Digital Media Project
Gamification
*/
include('header.php');
?>
<div id="main">
<div id="content">
<?php include('category_menu.php'); ?>
<article id="post-directory">
<?php
$g->debug();
$cat_slug = $_GET['id'];
$category = $g->get_category($cat_slug);
echo "<h1> Category " . $category['category_name'] . " </h1>";
//echo print_r($category, true);
$cat_id = $category['category_id'];
$catPosts = $g->category_posts($cat_id);
//echo print_r($catPosts, true);
foreach($catPosts as $catPost) {
//$category = $g->post_category($post['post_id']);
//echo 'category ' . print_r($category, true);
$post_date = $post['post_date'];
$postDate = date('l j F o', strtotime($post_date));
//echo "<h1><a href='post.php?id=".$post['post_id'].">Post Title: " . $post['post_title'] . '</a></h1>';
echo "<div id='post-entry-".$catPost['post_id']." class='post-entry'>";
echo "<h1 class='post-title'><a href=".BASE_URL."post/".$catPost['post_slug'].">" . $catPost['post_title'] . "</a></h1>";
//echo print_r($catPost, true);
echo "<span class='post_date'>" . $postDate . "</span>";
//echo "<div class='post_category'> Posted in <a href=post/" . $cat['category_slug'] . ">" . $cat['category_name'] . "</a></div>";
echo "<p>" . $catPost['post_content'] . "</p>";
echo "</div>";
}
?>
</article>
</div>
</div>
<?php include('footer.html'); ?>