View file view_cat.php

File size: 1.43Kb
<?php
include_once('./system/config.php');
$cat = mysql_fetch_assoc(mysql_query("SELECT * FROM `cat` WHERE `id` = '".int($_GET['id'])."'"));
$sys['title'] = ''.$cat['title'].'';
include_once('./system/head.php');

if(!$cat) {
echo '<div class="error">Ошибка ! Такой категории нет</div>';
include_once('./system/foot.php');
exit;
}

$c_note = mysql_result(mysql_query("SELECT COUNT(*) FROM `note` WHERE `id_cat` = '".$cat['id']."'"), 0);
echo '<div class="title">'.$cat['title'].'</div>';
nav_start($c_note, 10);
if ($c_note != 0) {
$sql_notes = mysql_query("SELECT * FROM `note` WHERE `id_cat` = '".$cat['id']."' ORDER BY `id` DESC LIMIT $start, 10");
while ($note = mysql_fetch_assoc($sql_notes)) {
echo '<div class="content"><a href="http://'.txt($_SERVER['HTTP_HOST']).'/notes/'.trans($note['title']).'-'.$note['id'].'.xhtml">'.$note['title'].'</a><br/>'.mb_substr($note['note'], 0, 200).'...</div>';
}
} else { echo '<div class="error">Записей нет !</div>'; }

view_nav('http://'.txt($_SERVER['HTTP_HOST']).'/category-'.int($_GET['id']).'.xhtml/');

if($user) {
echo '<div class="content2">
&raquo; <a href="http://'.txt($_SERVER['HTTP_HOST']).'/admin/w_cat.php?act=edit&amp;id='.$cat['id'].'">Изменить категорию</a><br/>
&raquo; <a href="http://'.txt($_SERVER['HTTP_HOST']).'/admin/w_cat.php?act=del&amp;id='.$cat['id'].'">Удалить категорию</a>
</div>';
}

include_once('./system/foot.php');
?>