Файл: journal/index.php
Строк: 22
<?php
//-----Создаем титл страницы-----//
$title = 'Газета';
//-----Подключаем функции-----//
require_once ('../system/function.php');
//-----Подключаем вверх-----//
require_once ('../system/header.php');
$count_category = mysql_result(mysql_query("SELECT COUNT(*) FROM `category` "), 0);
echo '<div class="menu">Последние публикации</div>';
$five = mysql_query("SELECT * FROM `article` ORDER BY `id` DESC LIMIT 5");
while ($fi = mysql_fetch_assoc($five))
{
echo '<div class="podmenu"><a href="/journal/article.php?id='.$fi['id'].'">'.$fi['title'].'</a></div>';
}
echo '<div class="menu">Категории</div>';
if (empty($user['max'])) $user['max']=10;
$max = $user['max'];
$k_post = $count_category;
$k_page = k_page($k_post,$max);
$page = page($k_page);
$start = $max*$page-$max;
if ($count_category != 0)
{
$result = mysql_query("SELECT * FROM `category` ORDER BY `id` DESC LIMIT $start, $max");
while ($section = mysql_fetch_assoc($result))
{
$article = mysql_result(mysql_query("SELECT COUNT(*) FROM `article` WHERE `id_category` = '".$section['id']."'"), 0);
echo '<div class="podmenu"><a href="/journal/category.php?id='.$section['id'].'">'.$section['title'].'</a> ['.$article.']</div>';
}
}
else
{
echo '<div class="podmenu">Категории пока не созданы.</div>';
}
if ($k_page>1) echo str('/journal/all_category.php?id='.$section['id'].'&',$k_page,$page);
//-----Подключаем низ-----//
require_once ('../system/footer.php');
?>