<?php require_once 'nsoconfig.php';?>
<?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, 8);
$rs = $pager->getResults();
?>
<?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">
            <div class="log"><span class="logl"><img src="images/ic_p.gif"><?php echo $catName?>&#12288;&#12288;&#12288;&#12288;&#12288;</span><span class="logr"><img width="150" height="26" src="images/plist.jpg"></span></div>
            <div class="h10"></div>
			<?php if ($rs): foreach ($rs as $row):
			$bigImage = getFileWithFullPathByPost($row['post_id'], 'image');
			$image = getImagePathBySize($bigImage, '200');
			?>
            <div class="proli">
                <div class="pjtt"></div>
                <div class="pro2">
                    <div class="pro2p"><a href="product_detail.php?id=<?php echo $row['post_id']?>"><img width="120" height="120" border="0" alt="<?php echo $post['title']?>" src="<?php echo $image?>"></a></div>
                    <div class="pro2t">
                        <div class="pro2brn"><a href="product_detail.php?id=<?php echo $row['post_id']?>"><img border="0" src="images/ic_b1.png"></a></div>
                        <h4><a href="product_detail.php?id=<?php echo $row['post_id']?>"><?php echo $row['title']?></a></h4>
                        <h5></h5>
                        <h6 class="STYLE1"><?php echo $row['preview']?></h6>
                    </div>
                </div>
            </div>
            <?php endforeach; endif;?>
            <div class="pj2nex"><?php echo $pager->getNavigation(); ?></div>
            <div class="h15"></div>
        </div>
        <?php include_once '_cake_product_siderbar.php';?>
    </div>
    <?php include_once '_cake_footer.php';?>