function get_comments_of_cat($cat_id)
{
    global $config_vars, $db;
    // makes this to the first comment of content $content_id
    $sql = 'SELECT * FROM ' . $config_vars['table_prefix'] . 'cat_comments
		WHERE (owner_id = ' . $cat_id . ') and (parent_id = 0) ORDER BY creation_date';
    if (!($result = $db->sql_query($sql))) {
        error_report(SQL_ERROR, 'get_comments', __LINE__, __FILE__, $sql);
    }
    while ($row = $db->sql_fetchrow($result)) {
        $com = new cat_comment();
        $com->generate_from_row($row);
        $com_array[] = $com;
    }
    return $com_array;
}
        }
    }
    $smarty->assign('comments', $comments);
}
$smarty->assign('cat_id', $HTTP_GET_VARS['cat_id']);
//there is no usefull title_name...
//$smarty->assign('title_name','');
if ($HTTP_GET_VARS['mode'] == "add") {
    $smarty->assign('parent_id', $HTTP_GET_VARS['parent_id']);
    $smarty->assign('title_page', $lang['add_comment']);
}
if ($HTTP_GET_VARS['mode'] == 'edit_comment') {
    if ($userdata['user_level'] == ADMIN) {
        $smarty->assign('users_data', get_users_data('user_id,username'));
    }
    if ($HTTP_GET_VARS['type'] == 'content') {
        $comment = new content_comment();
    } else {
        $comment = new cat_comment();
    }
    $comment->generate_from_id($id);
    $smarty->assign('text', $comment->get_feedback());
    $smarty->assign('user_id', $comment->get_user_id());
    $smarty->assign('poster_name', $comment->get_poster_name());
    $smarty->assign('topic', $comment->get_topic());
    $smarty->assign('title_page', $lang['edit_comment']);
    $smarty->assign('title_name', $comment->get_topic());
    // parent id is just as id here
    $smarty->assign('parent_id', $id);
}
$smarty->display($userdata['photo_user_template'] . '/comment.tpl');