View file portfolio/modules/portfolio/view_category.php

File size: 1.59Kb
<?php

  ###################################################
  #  Скрипт портфолио								      #
  #  Версия системы: 1.0							      #
  #  Автор: RonsoN								      #
  #  ICQ: 7-191-321									      #
  # Email: [email protected]					      #
  ###################################################

$id_category = int($_GET['id_category']);

if ($db->query("SELECT * FROM `category` WHERE `id` = '". $id_category ."' LIMIT 1")->rowCount() == 0) {

	header('Location: /pages/404.xhtml');
	exit();

}

$category = $db->query("SELECT * FROM `category` WHERE `id` = '". $id_category ."' LIMIT 1")->fetch();

$system['page_title'] = $category['title'];
require_once(HOME .'/system/header.php');

echo '<div class="menu">'.$category['title'].'</div>';

$works_n = $db->query("SELECT * FROM `works` WHERE `id_category` = '".$id_category."' ")->rowCount();

if($works_n == 0) {

	echo '<div class="main"><div class="error">Работ в данной категории нет!</div></div>';
	
	} else {

		$objects  = $system['objects'];
		nav_start($works_n, $objects);


	$works_sql = $db->query("SELECT * FROM `works` WHERE `id_category` = '".$id_category."' ORDER BY `id` DESC LIMIT $start, $objects ");


	while($works = $works_sql->fetch()) {

		echo '<div class="main">'.WORK.'<a href="/works/'.$works['id'].'.xhtml">'.$works['title'].'</a></div>';

	}

  view_nav(URL.'/category/'.$id_category.'.xhtml/');

}

echo '<div class="navi">
'.INDEX.'<a href="/">Главная</a>
</div>';

require_once(HOME.'/system/footer.php');

?>