<?php require_once 'nsoconfig.php';?>
<?php include_once '_cake_top.php';?>
    <?php include_once '_cake_header.php';?>
    <div id="main-content">
        <?php include_once'_cake_searchbar.php'?>
        <div class="pml">
        	<?php
			require_once NSO_INC_PATH . 'Pager.php';
			
			$theCat = trim($_GET['cat']);
			$catName = getCategoryName($theCat);
			$sql = "SELECT * FROM posts, rel_post_cat
					WHERE posts.id = rel_post_cat.post_id
					AND posts.status <> 'deleted'
					AND rel_post_cat.cat_id = {$theCat} 
					ORDER BY posts.date DESC";
			$pager = new Pager($nsodb, $sql, 15);
			$posts = $pager->getResults();
			?>
            <div class="pmlt1"><img src="images/ic_p.gif"><?php echo $catName?></div>
            <div class="h10"></div>
            <div class="pmlt3">
                <div class="pjtt"></div>
                <div class="pjltc">
                    <div class="pj3ca2">
                        <ul>
                        <?php if ($posts): foreach ($posts as $post): ?>
                            <li><a href="solution_detail.php?id=<?php echo $post['post_id']?>"><?php echo $post['title']?></a></li>
                        <?php endforeach; endif;?>
                        </ul>
                    </div>
                    <div class="pj3ca2r">
                        <ul>
                        <?php if ($posts): foreach ($posts as $post): ?>
                            <li><?php echo date('Y-m-d', strtotime($post['date']))?></li>
                        <?php endforeach; endif;?>
                        </ul>
                    </div>
                    <div class="pj2nex"><?php echo $pager->getNavigation();?></div>
                </div>
            </div>
            <div class="h15"></div>
        </div>
        <?php include_once '_cake_solution_siderbar.php'?>
    </div>
    <?php include_once '_cake_footer.php';?>