[PHP]$sql = "SELECT cat_id, cat_title, cat_order FROM " . BB_CATEGORIES . " ORDER BY cat_order";
if (!$q_categories = DB()->sql_query($sql))
{
bb_die('Could not query categories list');
}
if ($total_categories = DB()->num_rows($q_categories))
{
$category_rows = DB()->sql_fetchrowset($q_categories);
$sql = "SELECT * FROM ". BB_FORUMS ." ORDER BY cat_id, forum_order";
if (!$q_forums = DB()->sql_query($sql))
{
bb_die('Could not query forums information');
}
if ($total_forums = DB()->num_rows($q_forums))
{
$forum_rows = DB()->sql_fetchrowset($q_forums);
}
for ($i = 0; $i < $total_categories; $i++)
{
$template->assign_block_vars("c", array(
Вывод категорий
));
for ($j = 0; $j < $total_forums; $j++)
{
if ($forum_rows[$j]['cat_id'] == $cat_id)
{
if ($forum_rows[$j]['forum_parent'])
{
$template->assign_block_vars('c.f.sf', array(
Вывод под форумов
));
continue;
}
$template->assign_block_vars("c.f", array(
Вывод под категорий (ФОРУМОВ)
));
}// if ... forumid == catid
} // for ... forums
} // for ... categories
}// if ... total_categories[/PHP]
Как определить что у форумав нет под форумов, и вывести это? 