
01.02.2010, 17:13
|
|
Познающий
Регистрация: 01.06.2009
Сообщений: 38
Провел на форуме: 80872
Репутация:
2
|
|
Код:
<?php
$category = intval($_GET['category']);
if ($category != 0) {
$tpl->load_tpl('downloads.tpl');
$tpl->set_block("'\\[category\\](.*?)\\[/category\\]'si", "");
$tpl->set('[cat_navigation]', '');
$tpl->set('[/cat_navigation]', '');
$tpl->set('{navigation}', name_cat($category));
$tpl->compile('content');
$tpl->clear();
}
if ($category) {
$where_cat = "WHERE id_parent = '$category'";
$where_files = "WHERE category = '$category'";
} else {
$where_cat = "WHERE id_parent = 0";
$where_files = "WHERE category = 0";
}
$downloads_files_sql = $db->query("SELECT * FROM downloads_files $where_files");
$downloads_cat_sql = $db->query("SELECT * FROM downloads_category $where_cat ORDER BY position DESC");
$i = 0;
while ($row = $db->get_row($downloads_cat_sql)) {
$i ++;
$tpl->load_tpl('downloads.tpl');
$tpl->set_block("'\\[cat_navigation\\](.*?)\\[/cat_navigation\\]'si", "");
$tpl->set('[category]', '');
$tpl->set('[/category]', '');
$coun = $db->super_query("SELECT count(*) as count FROM downloads_files WHERE category = '{$row['id']}'");
$tpl->set('[cat_link]', '<a href="' . $PHP_SELF . '?do=downloads&category=' . $row['id'] . '">');
$tpl->set('[/cat_link]', '</a>');
$tpl->set('{count}', $coun['count']);
$tpl->set('{category}', check_full($row['name']));
$tpl->compile('content');
$tpl->clear();
}
$b = 0;
while ($row = $db->get_row($downloads_files_sql)) {
$buffer .= $row['title'];
$buffer .= '<br>';
$b++;
}
if ($i == 0 and $b == 0) {
$buffer .= 'В данной категории ничего нет.<br>';
}
$tpl->copy_tpl = $buffer . '<br>';
$tpl->compile('content');
$tpl->clear();
?>
|
|
|