Файл: BlogExl_v_3/modules/pages/cats.php
Строк: 15
<?
head('Все разделы');
info();
$ram = $dbs->query("SELECT * FROM `cat`")->num_rows;
$num = 10;
$total = intval(($ram - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$q = $dbs->query("SELECT * FROM `cat` order by `id` desc limit $start,$num");
if(!$q->num_rows){echo '<div class="post2">Разделов нет!</div>';}
while($a = $q->fetch_assoc()){
$cn = $dbs->query("SELECT * FROM `blog` where `id_cat` = '$a[id]'")->num_rows;
echo '<div class="post2"><a
href="cat.php?id='.$a['id'].'">'.$a['name'].'</a> ('.$cn.')</div>';
}
str('?&');
foot();
?>