<?php

require_once 'includes/header.php';
require_once 'includes/view.php';
require_once 'includes/topics.php';
require_once 'includes/posts.php';
require_once 'includes/categories.php';
$oTopic = new Topic();
$oTopic->load($_GET["TopicID"]);
echo View::renderTopic($oTopic);
$oCategory = new Category();
$oCategory->load($oTopic->CategoryID);
echo View::renderCategoryTwo($oCategory);
if (isset($_SESSION["MemberID"]) == false) {
    $sHTML = '<a href="login.php">New Post</a>';
    echo $sHTML;
} else {
    $sHTML = '<div class="newTopic"><a href="newPost.php?TopicID=' . $oTopic->TopicID . '">New Post</a></div>';
    echo $sHTML;
}
?>

<?php 
include_once 'includes/footer.php';