Ребят, помогите вывести категории списком.
<?php
if(!defined('DATALIFEENGINE'))
die("Hacking attempt!");
// ћультимедийность модул¤. ћен¤ть надо только эту строку
include ENGINE_DIR . '/data/' . $files . '_config_global.php';
// ћультимедийность модул¤.
$menu_files = dle_cache("menu_".$modulname);
if (!$menu_files)
{
include_once ENGINE_DIR.'/data/'.$modulname.'_config.php';
$cats = $db->query("SELECT `id`, `parentid`, `name`, `news_number`, `alt_name` FROM `" . PREFIX . "_cat_".$modul_dbtitle."` WHERE `parentid` = '0' ORDER BY `posi` ASC, `name` ASC, `id` ASC");
while($row = $db->get_row($cats))
{
if ($config ['allow_alt_url'] == "yes") {
if ($filesConfig ['nica_rewrite'] == "1")
$linkfile = "<a class=\"newfiles\" title=\"".$row['name']."\" href=\"".$config['http_home_url'].$modulname."/cat/".$row['id']."_".$row['alt_name'].".html\">".$row['name']." (".$row['news_number'].")</a>";
else
$linkfile = "<a class=\"newfiles\" title=\"".$row['name']."\" href=\"".$config['http_home_url'].$modulname."/cat".$row['id'].".html\">".$row['name']." (".$row['news_number'].")</a>";
} else
$linkfile = "<a class=\"newfiles\" title=\"".$row['name']."\" href=\"".$config['http_home_url']."index.php?do=".$modulname."&op=cat&id=".$row['id']."\">".$row['name']." (".$row['news_number'].")</a>";
$menu_files .= "<li>".$linkfile."</li>";
$id = $row['id'];
$menu_files2 = "";
$tpl->set ( '{cat2}', $linkfile );
$sub_cat = $db->query("SELECT `id`, `parentid`, `name`, `alt_name`, `news_number` FROM `" . PREFIX . "_cat_".$modul_dbtitle."` WHERE `parentid` = '{$id}' ORDER BY `posi` ASC, `name` ASC, `id` ASC");
if(!empty($sub_cat))
{
while($row2 = $db->get_row($sub_cat))
{
if ($config['allow_alt_url'] == "yes") {
if ($filesConfig ['nica_rewrite'] == "1")
$linkfile = "<a class=\"newfiles\" title=\"".$row2['name']."\" href=\"".$config['http_home_url'].$modulname."/cat/".$row2['id']."_".$row2['alt_name'].".html\">".$row2['name']." (".$row2['news_number'].")</a>";
else
$linkfile = "<a class=\"newfiles\" title=\"".$row2['name']."\" href=\"".$config['http_home_url'].$modulname."/cat".$row2['id'].".html\">".$row2['name']." (".$row2['news_number'].")</a>";
}
else
$linkfile = "<a class=\"newfiles\" title=\"".$row2['name']."\" href=\"".$config['http_home_url']."index.php?do=".$modulname."&op=cat&id=".$row2['id']."\">".$row2['name']." (".$row2['news_number'].")</a>";
$menu_files2 .= "<li>".$linkfile."</li>";
}
$db->free($sub_cat);
}
$menu_files .= $menu_files2;
}
$db->free($cats);
create_cache ("menu_".$modulname, $menu_files);
}
?>